The science of chance · explained

Does true randomness exist? PRNG, TRNG and lottery balls

Illustration: pseudo-random generator and physical noise
Illustration: Lottochaos

A computer always does exactly what its program says. So how can it draw lottery numbers at random? The answer: there are two kinds of random number generators, and only one of them is truly random.

Pseudo-randomness (PRNG): randomness from a formula

A pseudo-random number generator (PRNG) is a formula. You give it a starting value, the "seed", and it calculates a long sequence of numbers that looks random. But: same seed, same sequence. We tried it with Python's standard generator, drawing 6 from 49:

SeedNumbers drawn
422 · 8 · 15 · 16 · 18 · 41
42 (again)2 · 8 · 15 · 16 · 18 · 41
433 · 10 · 19 · 24 · 30 · 45

Whoever knows the seed knows the numbers. Many programs simply use the clock as the seed: the number of seconds since 1 January 1970. For simulations that is handy, because results can be repeated exactly. For a lottery it would be dangerous.

True randomness (TRNG): randomness from physics

A true random number generator (TRNG) measures an unpredictable physical process: electronic noise in a resistor, the decay of radioactive atoms, or single particles of light that either pass through or bounce off a half-silvered mirror. The last two are called quantum randomness: as far as we know, the outcome is unpredictable by nature.

A well-known example: the internet company Cloudflare films a wall of lava lamps in its San Francisco office and uses the ever-changing images as a source of randomness.

In practice, both are combined: a TRNG supplies the seed, then a certified PRNG quickly produces many numbers. That is how most electronic lottery drawing systems work.

What about lottery balls?

A draw machine is a physical random generator. The balls collide thousands of times; the tiniest difference at the start leads to a completely different result. On top of that comes transparency: the draw is broadcast and supervised. We checked on thousands of draws that the balls come out evenly, in our article on draw machines.

How do you test randomness?

You can never prove with certainty that a sequence is random. But you can check that it behaves like chance. The US standards institute NIST has published a set of tests for this (SP 800-22): are there as many 0s as 1s? Runs that are too long? Repeating patterns? Certified lottery generators must pass them.

But these tests have a limit: they do not protect against someone manipulating the generator from the inside. That is exactly what happened in the Eddie Tipton case. There, code review, separation of duties and oversight are what protect you.

And the generator on Lottochaos?

Our number generator uses your browser's crypto.getRandomValues function. It is a cryptographically secure generator that the operating system feeds with physical events. The numbers are created on your device and stored nowhere.

🎲 What it means for you
Balls or certified computer: in a properly run draw, every combination has exactly the same chance. A random "quick pick" is no luckier or unluckier than your own numbers. It is just shared less often, because it follows no pattern.

The Eddie Tipton casePatterns in chanceRandomness test

Sources: NIST SP 800-22 (Statistical Test Suite for Random and Pseudorandom Number Generators); Cloudflare, LavaRand; „Random chance is the essence of the lottery“ (2021); Bill Buchanan, „How A Geek Can Win in the Lottery“, Medium, 2018.
Our calculation: Python random (Mersenne Twister), sample(1–49, 6), seeds 42 and 43.

← The science of chance

▲