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 is the sequence of pseudorandom values, and
- — the "modulus"
- — the "multiplier"
- — the "increment"
- — the "seed" or "start value"
are integer constants that specify the generator. If c = 0, the generator is often called a multiplicative congruential method, or Lehmer RNG. If c ≠ 0, the generator is called a mixed congruential method.
Read more about Linear Congruential Generator: Period Length, Parameters in Common Use, Advantages and Disadvantages of LCGs, Comparison With Other PRNGs
Famous quotes containing the word generator:
“He admired the terrible recreative power of his memory. It was only with the weakening of this generator whose fecundity diminishes with age that he could hope for his torture to be appeased. But it appeared that the power to make him suffer of one of Odettes statements seemed exhausted, then one of these statements on which Swanns spirit had until then not dwelled, an almost new word relayed the others and struck him with new vigor.”
—Marcel Proust (18711922)