{
  "aliases": null,
  "backlinks": [
    {
      "field": "defines",
      "target": "3MDPTW005V"
    }
  ],
  "body": "\n## Summary\n\nA linear congruential generator is a [[pseudorandom number generator|C5FG6ARWVV]] whose state is an integer modulo $m$, updated by an affine map $x \\mapsto (ax + c) \\bmod m$.\nIt is one of the oldest and simplest generators, and its period and lattice structure can be analysed completely with elementary number theory.\nIts weaknesses, such as short periods of the low-order bits and points lying on few hyperplanes, made it a classic lesson in generator design.\n\n## Explanations\n\n### L1 human\n\nTake a number, multiply it by a fixed number, add another fixed number, and keep only the remainder after division by a modulus $m$.\nRepeat, and divide each result by $m$ to get numbers between $0$ and $1$.\nWith $m = 8$, multiplier $5$ and increment $1$, starting from $0$, the states are $0, 1, 6, 7, 4, 5, 2, 3$ and then the cycle repeats.\nIn practice $m$ is huge, such as $2^{64}$, so that the cycle is far longer than any computation.\nThe same simplicity that makes the generator fast also makes its patterns easy to detect, so it is no longer the default choice in serious simulations.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "kind": "concept",
    "msc": [
      "65C10",
      "11K45"
    ],
    "name": "Linear congruential generator",
    "same_as": {
      "wikidata": "Q1190228",
      "wikipedia": "Linear congruential generator"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Linear_congruential_generator"
      }
    ],
    "specializes": [
      "C5FG6ARWVV"
    ],
    "tag": "Q0K15AWV8H"
  },
  "kind": "concept",
  "link": "https://tamnd.github.io/math2/node/Q0K15AWV8H/",
  "links": [
    {
      "field": "specializes",
      "target": "C5FG6ARWVV"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/Q0K15AWV8H.md",
  "msc": [
    "65C10",
    "11K45"
  ],
  "name": "Linear congruential generator",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/Q0K/Q0K15AWV8H.md",
  "status": null,
  "tag": "Q0K15AWV8H",
  "uri": "m2://Q0K15AWV8H",
  "url": "https://tamnd.github.io/math2/wiki/linear-congruential-generator/",
  "writing": {
    "tag": "Q0K15AWV8H",
    "kind": "concept",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
