Generator works on the principle of Faraday's law of electromagnetic induction. Generator do not generate electrical energy actually, generator converts mechanical energy into electrical energy. Fleming's right hand rule is applicable for generators. There are two types of generator one is AC generator and second is DC generator.
Faraday's law states that:
EMF = -Ndϕ/dt
Where, N is number of turns of coil,
ϕ is the magnetic flux.