Sidetrack: Random Numbers (cont)
The most widely-used technique is called the Linear Congruential Generator (LCG)
- it uses a recurrence relation:
- Xn+1 = (a·Xn + c) mod m, where:
- m is the "modulus"
- a, 0 < a < m is the "multiplier"
- c, 0 ≤ c ≤ m is the "increment"
- X0 is the "seed"
- if c=0 it is called a multiplicative congruential generator
LCG is not good for applications that need extremely high-quality random numbers
- the period length is too short
- period length … length of sequence at which point it repeats itself
- a short period means the numbers are correlated
|