On the floor under the pendulum is another strong magnet. The two magnets are set so that they repel. As the two magnets get closer, they repel and the path of the cage is changed. This creates a random motion of the cage. In a way, motors are like magnetic pendulums.
All motors run on magnetic principles.
They work by alternately attracting and repelling magnetic fields. This changing interaction keeps the motor turning. The MagLev trains use the same principle. Powerful magnets that are cooled by liquid helium are installed in the cars of the train.