There are many methods of generating pseudorandom numbers. Some of them are middle square (not very good), Mersenne twister, linear congruential generator (one the oldest used in math libraries, but subject to sequential corellation artifacts), and cryptographically secure generators.