Determinism is the feature, not the flaw. A simulation whose randomness comes from a seeded recurrence can be reproduced exactly: rerun with the same parameters and seed, and every draw, every queue, and every estimate comes back identical, which is what makes a surprising result checkable and a bug findable. Write down the four numbers on this tab, and any classmate can regenerate your entire stream.
Reproducibility also buys sharper comparisons. To compare two system designs fairly, feed both the same random inputs (the same arrival times, the same service demands) so that any difference in the results is caused by the designs and not by luck. That technique, common random numbers, only exists because the “random” numbers are deterministic.
The price is that the stream is not random at all, and so it has to behave, statistically, like randomness. The two panels above are exactly that audit: the values must fill [0, 1] evenly, and no value may carry usable information about the ones that follow.
The state is a whole number xn between 0 and m − 1. Each step multiplies by
a, adds c, and keeps only the remainder after dividing by
m: the “mod” operation, the same wrap-around as a clock face. Dividing the
state by m rescales it into [0, 1), which is the un a simulation actually
consumes.
Because the next state depends only on the current state, and there are just m possible states, the sequence must eventually revisit a state and from then on repeat exactly. The length of that loop is the generator's period, and it is one reason m is chosen enormous. Try the toy preset (m = 16) and step through the table until it repeats; then consider how far apart the same two states are under the minimal standard.
For c ≠ 0, the Hull–Dobell theorem (1962) says that the cycle visits all m states from every seed precisely when three conditions hold: (1) c and m share no common factor; (2) every prime that divides m also divides a − 1; and (3) if 4 divides m, then 4 also divides a − 1. The toy preset and the C-standard-style preset both satisfy all three, which is why the toy has a full period of 16.
For c = 0, the state 0 is stuck, and so a full period is impossible; what is attainable depends on m. With m prime, the period is m − 1 from any nonzero seed exactly when a is a primitive root mod m (a special condition from number theory), which is the minimal standard's design. With m a power of two, the best possible is m/4, attained when a ≡ ±3 (mod 8) and the seed is odd; RANDU sits exactly there, with period 2²⁹ = m/4.
The chi-square test cuts [0, 1] into k equal bins and compares each observed count with the n/k a uniform distribution would put there; the statistic totals the squared mismatches. The Kolmogorov–Smirnov statistic Dn pushes the same idea to its limit. Sort the values so that the r-th smallest one “should” sit near r/n. Chi-square counts crowding in a few wide bins; K–S in effect cuts a bin so fine that each holds a single point and reports the farthest any point strays from where its rank says it should sit. That farthest stray is exactly the biggest vertical gap between the empirical CDF and the diagonal, marked on the small plot. Both p-values answer the same question: could a mismatch this large plausibly come from truly uniform draws?
Both tests treat the sample as a bag of values – they are not sensitive to the order of the values. Judging whether the order is consistent with independent draws is the job of separate tools: autocorrelation tests, runs tests, and the lattice panel beside the uniformity tests.
Consecutive states of an LCG satisfy xi+1 = (a·xi + c) mod m. Without the mod, every pair (xi, xi+1) would sit on the single straight line y = a·x + c; the mod subtracts some whole multiple of m from y, and so the pair sits on one of the parallel lines y = a·x + c − j·m instead. Dividing by m to get the u values only rescales that picture into the unit square. Pairs of consecutive outputs therefore cannot land just anywhere: they are confined to a family of parallel lines, a lattice. The same argument confines triples of consecutive outputs to parallel planes in three dimensions, and so on in every dimension.
Every LCG has such a lattice; there is no parameter choice that escapes it. The design question is how fine it is. A good multiplier packs the lines so closely that the grain is far below anything a simulation could resolve; a bad one (RANDU is the canonical case) leaves gaps you can see by eye, meaning huge regions of the square, or of the cube, that pairs of “random” values can never visit. George Marsaglia made this pointed observation in a famously titled 1968 paper, “Random numbers fall mainly in the planes” (PNAS 61(1):25–28).
Raising the lag k probes a different slice of the dependence structure: the pairs (un, un+k) obey the k-steps-ahead recurrence, which is itself an LCG whose multiplier is ak mod m, and so a generator can look fine at lag 1 and still show its grain at another.
The next state in an LCG is computed from the current state, and so once any state repeats, everything after it repeats too. Nothing guarantees the repeat reaches all the way back to the seed, though. If the update rule is many-to-one, meaning two different states map to the same next state, then some states have no way of being reached a second time: once the orbit leaves them, they are gone for good. States the cycle keeps returning to are called recurrent; states visited at most once on the way in are called transient; and the steps spent among transient states before the orbit settles onto its cycle are the lead-in the period card reports. Drawn on paper, such an orbit looks like the letter ρ: a short tail flowing into a loop.
A multiplicative component x → a·x mod m is reversible exactly when a shares no factor with m; every state then has a unique predecessor, and every orbit is a pure loop with no lead-in. When a and m share a factor, information is destroyed at each step. With a = 2 and m = 26, for example, the states x and x + 13 collide into the same next state, and after one step, every reachable state is even, and so an odd seed such as 1 can never come back. Well-designed generators choose parameters that keep the update reversible, and so no state is wasted on a tail; RANDU's even seeds falling into shorter cycles (tab ①) are this same phenomenon in another costume.
Yes. A CLCG is a deterministic recurrence like any other, and so its pairs of consecutive outputs still cannot land just anywhere. Each component keeps the lattice that every LCG has (tab ①), but the other component's cycle drifts across it, smearing the stripes. Combining does not remove structure so much as fold two structures against each other until neither is visible at any usable scale.
A generator that remembers only its last value must repeat as soon as any single value recurs. A generator that remembers its last k values only repeats when a whole run of k values recurs together, and there are mk possible runs. A well-chosen order-k recurrence visits every state except the all-zero one before repeating, for a period of mk − 1. The toy preset shows the jump at a human scale: the same modulus 13 that caps a c = 0 LCG at period 12 supports period 168 = 13² − 1 with just one extra word of memory.
MRG32k3a (L'Ecuyer 1999) is where this tab and tab ② meet: two order-3 MRGs over different moduli, combined by subtraction exactly as the CLCG combines two LCGs, with period about 2¹⁹¹. It is the generator inside many production simulation tools.
MRG32k3a's cycle is not just enormous; it also comes with a jump-ahead operator. Because the recurrence is linear, two applications of it collapse into a single rule of the same small size, and doubling again gives the four-step rule, the eight-step rule, and so on. What gets squared is the step rule itself, never a state, and so 127 doublings build a rule that leaps 2¹²⁷ steps in one application, without producing any of the states in between. Size and jump-ahead together make it possible to divide the one cycle into streams (blocks 2¹²⁷ long) and each stream into substreams (blocks 2⁷⁶ long), each entered by jumping straight to its starting state; only the very first position is ever seeded by hand. In practice, each source of randomness in a simulation gets its own stream, and each replication advances to the next substream within it, which keeps common-random-number comparisons aligned across replications. Every block behaves as an independent generator, with no need to invent a new seed for any of them, and with none of the risk that hand-picked seeds land on overlapping stretches of the same cycle. This stream–substream scheme is from L'Ecuyer et al. (2002, Operations Research 50(6):1073–1075).
In generation with tournament-style watermarking, distortion is only a problem with repeated histories. A history of four real numbers essentially never recurs, and so each skewed conditional contributes a single draw whose support is unchanged, and nothing accumulates where a histogram could show it. Tab ⑦ is the opposite case – a fourteen-word vocabulary repeats histories constantly – and it enforces the same one-draw rule explicitly, as repeated-context masking.
The watermark does add dependence, but it is routed entirely through the keyed scores. Each emitted value relates to its four predecessors through the scoring rules. Without the key, those scores cannot be recomputed, and lag plots and the other unkeyed diagnostics show nothing; with the key, the detector's average score stands tens of null standard errors clear of chance in a few hundred values. The pattern is there, in the same sense an LCG's lattice is there, and it is just as invisible until you apply the right filter.
A detector needs nothing but the stream and the key. Reading the scoring inputs from the visible outputs, rather than from a hidden counter, makes detection self-synchronizing. The language-model version reads the recent words for the same reason – the text itself is all a detector ever gets.
Because a bias that acts once is invisible, and a bias that acts twice is the same bias twice. The winner of a single tournament is still a word the model offered, and one draw cannot reveal which conditional produced it; the repeat demo above shows what surrendering that safety costs. Masking turns the safety into a rule – each four-word history gets its tournament at most once per text – and the detector, computing the same mask from the same visible words, skips exactly the same positions. How often the rule bites depends on the vocabulary: in this widget's 230-word world, a third of the words in a few pages land on a used history, whereas in a real model's hundred-thousand-word vocabulary exact four-word repeats are rare outside genuinely repetitive text – the very text where a repeated bias would otherwise pile into a visible pattern.
Tab ⑥ never needed the rule spelled out: its histories are four real numbers, which essentially never recur, and so every bias acts once by itself. The principle on both tabs is the same – work inside the diversity the source already offers, spend each history's bias at most once, and let the biases cancel everywhere except along the key's own score axis, where they all point the same way.