NIST

linear congruential generator

(algorithm)

Definition: A class of algorithms that are pseudo-random number generators. The next number is generated from the current one by rn+1 = (A × rn + B) mod M, where A and M are relatively prime numbers.

Generalization (I am a kind of ...)
pseudo-random number generator.

Note: When implemented in software, A and B may be chosen so as to have integer overflow on nearly every step, and therefore have a less predictable sequence and avoid the mod operation. The low-order bits tend to be less random than high-order bits. This is improved by discarding some of the low-order bits. Therefore, the range of random numbers is less than the range of the integer used in the computation.

Better algorithms are available, but they are more complex.

Author: BB


Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 26 July 2021.
HTML page formatted Mon Jul 26 11:58:06 2021.

Cite this as:
Bob Bockholt, "linear congruential generator", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. 26 July 2021. (accessed TODAY) Available from: https://www.nist.gov/dads/HTML/linearCongruentGen.html