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.

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

More information

Karl Entacher's thorough review and comparison of many linear congruential generators.


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

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

Entry modified 17 December 2004.
HTML page formatted Mon Sep 11 09:46:04 2006.

Cite this as:
Bob Bockholt, "linear congruential generator", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 17 December 2004. (accessed TODAY) Available from: http://www.nist.gov/dads/HTML/linearCongruentGen.html

to NIST home page