A linear congruential generator (LCG) represents one of the oldest and best-known pseudorandom number generator algorithms. The theory behind them is easy to understand, and they are easily implemented and fast.
The generator is defined by the recurrence relation:
where Xn is the sequence of pseudorandom values, and
are integer constants that specify the generator.
The period of a general LCG is at most m, and for some choices of a much less than...
more
A linear congruential generator (LCG) represents one of the oldest and best-known pseudorandom number generator algorithms. The theory behind them is easy to understand, and they are easily implemented and fast.
The generator is defined by the recurrence relation:
where Xn is the sequence of pseudorandom values, and
are integer constants that specify the generator.
The period of a general LCG is at most m, and for some choices of a much less than that. The LCG will have a full period if and only if:
While LCGs are capable of producing decent pseudorandom numbers, this is extremely sensitive to the choice of the coefficients c, m, and a.
Historically, poor choices had led to ineffective implementations of LCGs. A particularly illustrative example of this is RANDU which was widely used in the early 1970s and resulted in many results that are currently in doubt because of the use of this poor LCG .
If a linear congruential generator is seeded with a character and then iterated once, the...
less