Linear Congruential Generator
Swipe Linear Congruential Generator Vs...
Linear Congruential Generator News
Description
A linear congruential generator ( LCG ) is an algorithm that yields a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. The method represents one of the oldest and best- known pseudorandom number generator algorithms. The theory behind them is relatively easy to understand, and they are easily implemented and fast, especially on computer hardware which can provide modular arithmetic by storage-bit truncation.
The generator is defined by the recurrence relation:
X n + 1 = ( a X n + c ) mod m {\displaystyle X_{n+1}=\left(aX_{n}+c\right){\bmod {m}}}
where X {\displaystyle X} is the sequence of pseudo-random values, and
m , 0 < m {\displaystyle m,\,0<m} — the "modulus"
a , 0 < a < m {\displaystyle a,\,0<a<m} — the "multiplier"
c , 0 ≤ c < m {\displaystyle c,\,0\leq c<m} — the "increment"
X 0 , 0 ≤ X 0 < m {\displaystyle X_{0},\,0\leq X_{0}<m} — the "seed" or "start value"
are integer constants that specify the generator. If c = 0, the generator is often called a multiplicative congruential generator (MCG), or Lehmer RNG. If c ≠ 0, the method is called a mixed congruential generator.: 4-
When c ≠ 0, a mathematician would call the recurrence an affine transformation, not a linear one, but the misnomer is well-established in computer science.: 1
Related
MoreTags
Collections
Details
- Slug: linear-congruential-generator
- Total Views: 208
- Added: Jul 20, 2024