Math 2.0

Numerical analysis Definition

Linear congruential generator

Builds on Pseudorandom number generatorModulo operationIntegers modulo n

Definition

Let m≥2m \ge 2 be an integer, the modulus, and let aa, cc and X0X_0 be integers with 0<a<m0 < a < m, 0≤c<m0 \le c < m and 0≤X0<m0 \le X_0 < m. The linear congruential generator with multiplier aa, increment cc and seed X0X_0 is a pseudorandom number generator. Its state space is {0,…,m−1}\set{0, \ldots, m-1} and its states are Xn+1=(aXn+c) mod m,n≥0,X_{n+1} = (a X_n + c) \bmod m, \qquad n \ge 0, where  mod \bmod is the modulo operation. Its outputs are the numbers un=Xn/m∈[0,1)u_n = X_n / m \in [0, 1). If c=0c = 0 it is called a multiplicative congruential generator, or Lehmer generator.

Remarks

Example: m=8m = 8, a=5a = 5, c=1c = 1, X0=0X_0 = 0. The states are 0,1,6,7,4,5,2,3,0,…0, 1, 6, 7, 4, 5, 2, 3, 0, \ldots, for instance 5⋅7+1=36≡4(mod8)5 \cdot 7 + 1 = 36 \equiv 4 \pmod 8; all 88 residues appear, so the period is mm. Non-example: Xn+1=Xn2 mod mX_{n+1} = X_n^2 \bmod m is not a linear congruential generator, because the map x↦x2x \mapsto x^2 is not of the form x↦ax+cx \mapsto ax + c. The map x↦ax+cx \mapsto ax + c is an affine map of the ring of integers modulo mm, so the period is at most mm. The Hull–Dobell theorem treats c≠0c \ne 0. The period equals mm for every seed if and only if three conditions hold. They are: cc and mm are coprime, every prime factor of mm divides a−1a - 1, and 44 divides a−1a - 1 if 44 divides mm. In the example, gcd⁡(1,8)=1\gcd(1, 8) = 1 and a−1=4a - 1 = 4, so the conditions hold.

Reading path

To understand this page from the ground up, read these 4 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Integers modulo n concept
  2. Modulo operation concept
  3. Pseudorandom number generator concept
  4. Linear congruential generator definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Linear_congruential_generator
About this page
Tag3MDPTW005V
URIm2://3MDPTW005V
Kinddefinition
WritingW0 stub
MSC65C10, 11K45
DefinesLinear congruential generator
UsesPseudorandom number generator, Modulo operation, Integers modulo n

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.