# Why do the magnetic poles of the Earth get reversed? [duplicate]

It has been confirmed that the magnetic poles of the Earth get reversed , but why should they get reversed in the first place ?

Also, why is their pattern of reversal so arbitrary ?

Geomagnetic polarity during the last 5 million years (Pliocene and Quaternary, late Cenozoic Era) has been shown. Dark areas denote periods where the polarity matches today's polarity, light areas denote periods where that polarity is reversed.