Concept

Period

How many steps a repeating sequence takes before it comes back to where it started. For a generator it bounds how much output is usable, and for a linear recurrence over a finite field it is decided by whether a polynomial is primitive.

Named by 6 essays across one field — each of them below, with the objects they name alongside it.

256 consecutive pairs from xₙ₊₁ = 137xₙ + 187 mod 256. Consecutive outputs of a linear congruential generator plotted as points of a square, falling on a small family of evenly spaced parallel lines.

The planes a recurrence cannot leave

One multiplication and one addition, taken modulo a fixed number, produce a sequence that passes for random one value at a time. Taken two or three at a time it does not, and the reason is a whole-number relation that pins every point onto one of a small family of parallel lines.

computation · Pseudorandomness
Every pattern, exactly as often. A table over 4 window lengths of a shift register's output stream: how many bit patterns are possible, how many actually occur, and the difference between the most and least frequent, which is one in every row.

Nineteen thousand bits of state

The generator most simulations actually use is not clever. It is a linear recurrence over the two-element field with an enormous state, and its virtues are a proved period, a proved equidistribution and speed — none of which is unpredictability, which it does not have and does not claim.

computation · Pseudorandomness
How far a filter spreads a generator's output. Bars for bit depths 1 to 8: the ceiling ⌊24/v⌋ outlined, the raw generator's count of evenly spread consecutive outputs (24, 3, 3, 3, 3, 3, 3, 3), and the tempered count (24, 12, 6, 6, 3, 3, 3, 3).

A filter that changes only the spread

The generator most simulations use passes every output through a last scrambling step before anyone sees it. The step is reversible, it changes nothing about the period, and it cannot make the generator any less predictable. What it changes is which patterns of consecutive outputs can occur at all — on a small twisted generator, from half of them to every one.

computation · Pseudorandomness
The low bits of a congruential generator, and the bits a permutation shows. First 128 steps of a 16-bit congruential generator: low state bits with periods 2, 4, 8, 16, 32, 64, 128, 256; permuted output bits all with period 65536.

A rotation that hides the lattice

A congruential generator modulo a power of two has a lowest bit that alternates and pairs of outputs that lie on a few lines. Keep the generator exactly as it is, and show only eight bits of each state, rotated by an amount the state's own top bits choose: every output bit now runs the full cycle, the pairs fill the square as a random sequence would, and triples pass a test the state's own bits fail by a factor of six. Nothing about the state has changed, and four outputs still give it away.

computation · Pseudorandomness
Every order of nine cards, and the ones a seed can reach. 16-bit LCG, 65,536 seeds, Fisher–Yates on 9 cards (high bits): 62616 of 362880 orders reached.

A seed is a deck

A shuffle that is perfectly correct, driven by a generator that passes every statistical test, can still deal almost none of the possible decks. A shuffle program is a function from the generator's starting state to an ordering of the cards, so it can never produce more orderings than the generator has states: a 32-bit seed reaches one deck in about 10⁵⁸. On nine cards and a 16-bit generator every case can be checked — 62,616 of the 362,880 orders are ever dealt — and on a full deck, six cards on the table are enough to name the seed and every card still to come.

computation · Pseudorandomness
The cells a small generator can reach. m = 256, a = 229, 64×64 cells: plain 256 cells, 10 distinct gaps; scrambled 252 cells, 46 distinct gaps.

Birthdays spaced too evenly

Scatter n birthdays through a year of k days, sort them, and count how many of the gaps between neighbours repeat an earlier gap. For random birthdays the count is close to a Poisson variable with mean n³/4k. A linear congruential generator with m states, read in pairs, matches that law until the grid has as many cells as the generator has states, and then leaves it at once: at sixteen times as many cells, every run of the spacings count rejects it. The sample that catches it is about five times the cube root of the period — 8,192 outputs for a 32-bit generator, thirteen million for a 64-bit one — and the same states, scrambled before they are read, pass.

computation · Pseudorandomness

Named alongside it

The objects these essays reach for when they reach for this one.

PseudorandomnessEquidistributionLinear recurrenceBirthday problemExhaustive searchFinite fieldLatticeModular arithmeticPigeonhole principleUniform distributionBasisCollision

All concepts