Pseudorandom Number Generator

Source code: Lua or JavaScript

Set a seed and generate a sequence of pseudorandom numbers using the Linear congruential generator.

LCG is a simple, fast and reliable method for generating pseudorandom numbers. LCG is a great choice for generating pseudorandom numbers, however, it is not cryptographically secure.

For comparison, you can also generate a sequence of pseudorandom numbers using the Middle-square generator.

MSM is a simpler, but far less reliable method as it is bound to begin repeating a sequence or a number indefinitely at some point, at which point there's no resemblance of randomness.

Interesting seed values for MSM that demonstrate repeating patterns: 12345678933, 12345679001, 12745678161, 22745678162.