How Computers Fake Randomness (and Why It's Fine)
A computer is a machine built to do exactly what it's told, identically, every time. So how does it roll a die? The honest answer: it doesn't. It computes sequences that merely look random β and the story of how well that works, where it breaks, and when it matters is one of computing's quiet masterpieces.
The pseudo in pseudorandom
A pseudorandom number generator (PRNG) is a formula that turns a current state into a next state, over and over, spitting out numbers along the way. Start from the same seed and you get the identical sequence forever β John von Neumann, who built one of the first PRNGs in the 1940s, joked that anyone using arithmetic for random digits is "in a state of sin." Yet good modern formulas produce streams that pass every statistical test humanity has devised: uniform spread, no detectable cycles, no correlations. Deterministic underneath, indistinguishable from chance on top.
A famous cautionary tale
Badness here is subtle. IBM's RANDU generator, shipped through the 1960s, looked fine one number at a time β but plot its outputs as 3D points and they collapse onto just 15 flat planes. Every Monte Carlo simulation that relied on it inherited invisible structure. The lesson stuck: randomness can fail in dimensions you didn't think to check, which is why modern generators (like the Mersenne Twister, or the xorshift family powering most browsers' Math.random()) are battle-tested against entire batteries of statistical attacks.
Where seeds come from
If the seed determines everything, the seed is everything. Systems harvest entropy β unpredictable physical noise β from timing jitter between your keystrokes, disk and network interrupt timings, and dedicated hardware circuits that amplify thermal noise in silicon. Cloudflare famously seeds part of its infrastructure by pointing a camera at a wall of lava lamps. The physical world supplies the dice; the PRNG merely stretches one roll into billions.
When fake is fine β and when it's fatal
For games, shuffles, raffles and simulations, a quality PRNG is not a compromise; it's mathematically fairer than physical alternatives (real coins have a measured ~51% bias toward their starting face; real dice have drilled pips and worn corners). The stakes change with an adversary. If an attacker can predict your generator, they can forge session tokens or empty a poker site β as happened in 1999 when programmers reverse-engineered PlanetPoker's shuffle from its timestamp seed and could name every card in the deck. That's why cryptographic RNGs (like your browser's crypto.getRandomValues) mix continuous fresh entropy into constructions designed to be unpredictable even to someone who knows the algorithm.
Fairness you can inspect
Every spin and roll on this site uses the browser's built-in generator β statistically uniform, no memory, no house edge.
Explore the tools βThe philosophical kicker
Is anything truly random, or just unpredictable from where we stand? A coin flip obeys Newton; a PRNG obeys arithmetic; even quantum randomness is an interpretation with asterisks. For every practical purpose, random enough for the use case is the only standard there is β and for picking tonight's restaurant, your browser clears the bar with room to spare.