Ask a hundred people for a "random" number between 1 and 10 and about a third will say 7. Ask a computer and you'll get something that passes every statistical test for randomness — produced by a completely deterministic machine that is, strictly speaking, incapable of guessing. Both facts are stranger than they look, and understanding them explains everything from shuffled playlists to why a wall of lava lamps helps secure a chunk of the internet.
The Central Paradox: Deterministic Machines Faking Chance
A computer follows instructions exactly; identical inputs yield identical outputs, every time. So it can't be random — it runs a pseudorandom number generator (PRNG): an algorithm that takes a starting value (the seed) and grinds out a sequence so statistically well-behaved that no ordinary test can distinguish it from chance.
A classic simple example, the linear congruential generator: next = (a × current + c) mod m. Multiply, add, take the remainder, repeat. With well-chosen constants the output looks like noise, is uniformly distributed, and passes basic tests — while being entirely determined by the seed. Same seed, same sequence, forever. That reproducibility is a feature as often as a bug: it's how scientific simulations are made repeatable, how a game can regenerate an identical procedural world from a short code, and how bugs involving randomness can be debugged at all. Generate sequences to play with in the Random Number Generator.
Pseudorandom vs Truly Random
| Pseudorandom (PRNG) | True random (TRNG) | |
|---|---|---|
| Source | Algorithm + seed | Physical noise |
| Reproducible? | Yes (same seed → same sequence) | No, ever |
| Speed | Millions per second | Slow, limited by the physics |
| Good for | Simulations, games, sampling, shuffling | Cryptographic keys, lotteries, gambling |
True randomness has to come from outside the algorithm — the physical world. Real sources in use today: atmospheric radio noise (random.org), radioactive decay timing (genuinely unpredictable at the quantum level), thermal noise in circuits, the microsecond jitter of your keystrokes and mouse movements, and — most famously — Cloudflare's wall of ~100 lava lamps in its San Francisco lobby, filmed continuously so the chaotic blobs feed entropy into key generation. Modern CPUs also include hardware entropy instructions, and operating systems mix all available noise into an entropy pool.
Why the Distinction Can Be Life-or-Death (for Money)
If an attacker can guess your seed, they can regenerate your entire "random" sequence. This isn't theoretical:
- Early online poker sites seeded shuffles with the clock; researchers demonstrated they could deduce the deck mid-hand.
- A 2008 Debian packaging error crippled the entropy in OpenSSL key generation, leaving predictable cryptographic keys across a huge number of servers — every key made in that window had to be regenerated.
- Slot machines with weak PRNGs have been exploited by teams timing spins.
Which is why cryptography demands CSPRNGs (cryptographically secure generators) seeded from hardware entropy — the standard behind any decent Password Generator. A password is only as unguessable as the randomness that produced it, and this is exactly why "pick a memorable password" loses to machine-generated strings: human choices cluster hard.
Humans: Comically Bad at Randomness
Asked to produce random sequences, people reliably:
- Avoid repeats — real coin flips give runs of 4+ heads regularly; human-invented sequences almost never do.
- Alternate too much, believing balance is owed — the gambler's fallacy wearing a lab coat (full treatment in our probability myths piece).
- Favor the middle and odd numbers — hence the famous 7, and why PINs like 1234 and years 19xx dominate leaked datasets.
The irony: truly random data looks suspiciously clumpy, and fabricated data looks too tidy. Auditors exploit this — Benford's Law, which says leading digits in real-world figures follow a specific uneven distribution (1 appears ~30% of the time), catches invented numbers in accounting fraud precisely because forgers spread digits evenly. Apple famously had to make shuffle less random — because genuine randomness clustered artists and users complained it was broken.
How to Tell If a Generator Is Any Good
Statisticians run batteries of tests (frequency, runs, gaps, spectral, and suites like Diehard) looking for structure. In everyday terms, three practical rules:
- Match the tool to the stakes. Shuffling a playlist or picking a raffle winner: any standard PRNG is fine. Generating a key, seed phrase or lottery draw: demand a cryptographic/hardware source.
- Watch for range bias. Naively taking a remainder (rand() % 10) subtly favors low numbers when the range doesn't divide evenly — a genuine bug in more sweepstakes code than anyone would like.
- Never invent your own for security. The graveyard is full of clever homemade generators; use the platform's cryptographic API.
Worked Example: Two Identical Passwords, 10²⁴ Apart
Omar generates a 16-character password. It looks like noise, his strength meter says "excellent," and he moves on. Whether it is genuinely strong depends entirely on something he cannot see: how many distinct outputs the generator could have produced. That count is the search space, and here is what it is worth against an offline attacker testing a fast hash at roughly 10¹² guesses per second.
| Where the password came from | Search space | Entropy | Time to crack |
|---|---|---|---|
| "Summer2026!" — human-chosen | ~10⁹ rule-mangled guesses | ~30 bits | under a second |
| 8 random lowercase letters | 2.1 × 10¹¹ | 37.6 bits | 0.2 seconds |
| 4-word dice-rolled passphrase | 3.7 × 10¹⁵ | 51.7 bits | ~1 hour |
| 16 chars, full keyboard, CSPRNG | 3.7 × 10³¹ | 104.9 bits | ~10¹² years |
| The same 16 chars, generator seeded from the clock | 3.2 × 10⁷ | 24.9 bits | 0.00003 seconds |
The last two rows deserve a long look:
- They are the same password. Same characters, same length, same symbols, same meter reading — and roughly 10²⁴ times apart in real security. Nothing about the string reveals which one you have.
- Entropy lives in the generator, not in the glyphs. If the seed was the current second and the attacker knows the account was created sometime last year, there are only about 31.6 million possible sequences to replay. Length becomes decoration.
- The capital and the exclamation mark bought about 2 bits, not 20. Cracking tools apply the same predictable substitutions everyone uses, so "Summer2026!" is a dictionary word plus a year plus a rule, not eleven independent characters.
- Passphrases need more words than people expect. Four dice-rolled words fall in about an hour against an offline attack; six words push the same attack out to roughly 7,000 years. The jump comes from adding 26 bits, not from the words looking harder.
One variation changes the whole picture: assume the attacker can only guess through a rate-limited login, say 10⁴ attempts per second instead of 10¹². The four-word passphrase goes from one hour to about 11,600 years. The password did not improve — the threat model did. That is why a service's database breach is so damaging: it converts every online attack into an offline one overnight. Generate strings from a proper entropy source in the Password Generator, and if those exponents are hard to hold onto, our scientific notation guide is the decoder ring.
Common Mistakes About Randomness
- Seeding a generator from the clock. The current time has a few million plausible values, so it makes every downstream "random" output guessable. The related classic is re-seeding inside a loop, which makes a program emit the same number over and over while looking perfectly correct.
- Using the general-purpose random function for security. The default generator in most languages is optimized for speed and statistical quality, not unpredictability, and its internal state can often be recovered from a handful of outputs. Anything protecting money, identity or keys needs the platform's cryptographic API instead.
- Judging randomness by whether it looks random. In 100 fair coin flips, a streak of six or more identical results shows up most of the time, and genuine random data is far clumpier than intuition allows. Suspiciously even spacing is evidence of tampering, not of quality.
- Trusting a shuffle without checking the state size. A deck of 52 cards has 8 × 10⁶⁷ possible orderings, but a generator with a 32-bit seed can reach only about 4.3 × 10⁹ of them. Almost every possible shuffle is unreachable, which matters enormously for a card room and not at all for a party playlist.
- Confusing "random" with "uniform." Random numbers can follow any distribution, and a normal or exponential distribution is not a broken uniform one. Simulating arrival times, failure rates or measurement noise with uniform draws produces results that are precisely wrong in a way no statistical test of the generator will catch.
- Assuming a true random source is always the better choice. Hardware entropy is slow and, by definition, unrepeatable, so a simulation seeded from it cannot be reproduced or debugged. Use a seeded pseudorandom generator when reproducibility is the point, and save the physical entropy for keys and draws where predictability would be a disaster. Check the distribution of whatever you generate in the Statistics Calculator.
The Bottom Line
Computers don't roll dice — they run recipes so intricate the output is indistinguishable from chance, and reach out to lava lamps, radio static and atomic decay when "indistinguishable" isn't good enough. Randomness is streakier than intuition allows and human guesses are wildly patterned, which is why machines make better dice than we do. Draw fair numbers with the Random Number Generator, secure your accounts with the Password Generator, and check the spread of any sample you collect in the Statistics Calculator.
0 Comments
No comments yet — be the first to share your thoughts.