Pseudo Random Number Generation
tags: modulooperator random
One of the simplest examples of a pseudorandom number generator(PRNG) is the linear congruential generator(LCG).


We can use this method to generate a sequence of pseudo random numbers.


The generated output:
[1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2, 1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2, 1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2, 1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2, 1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2, 1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2, 1, 28]
The sequence 1, 28, 36, 21, 24, 10, 53, 31, 22, 64, 2 repeats. The length of this sequence is called the period of PRNG. In this case, it is 11.