How Random Generators Actually Work
Published: October 20, 2025 Ā· 8 min read
You click "Generate." A number appears. A spinner lands. A team forms. It feels random. But here's the uncomfortable truth: computers can't actually be random.
The Problem with Digital Dice
Real dice are random because they're chaotic physical objects. The exact angle you throw, the air currents, the microscopic imperfections in the tableāthese combine into outcomes you can't predict or reproduce.
Computers don't have that luxury. They're deterministic machines. Given the same input, they must produce the same output. That's literally their job. So how do we get randomness from a machine that can't be random?
We fake it. Really, really well.
Enter: Pseudorandom Number Generators (PRNGs)
A PRNG is an algorithm that generates sequences of numbers that look random, feel random, and pass statistical tests for randomnessābut are actually completely deterministic.
Think of it like this: Imagine a cookbook with infinite recipes. If I tell you to start at page 42, you'll make the same sequence of dishes as anyone else who starts at page 42. The recipes seem random if you don't know the starting page, but they're actually predetermined.
The "starting page" is called a seed.
How Seeds Work
When you use our random number generator or spinner, we create a seedāusually from the current timestamp down to the millisecond. That seed gets fed into a mathematical formula that churns out your "random" result.
Here's the cool part: same seed = same result. That's why our permalink feature works. When you share a link to your spinner result, the seed is encoded in the URL. Anyone who opens that link uses the same seed, sees the same result.
Not a bugāit's a feature.
The Math Behind the Magic
Randoly uses an algorithm called mulberry32. It's a specific type of PRNG designed to be fast, have good statistical properties, and produce numbers that pass randomness tests.
Without drowning you in math, here's the gist: mulberry32 takes a seed, scrambles it through bitwise operations (shifting, XORing, multiplying), and outputs a number. That output becomes the input for the next iteration. The scrambling is chaotic enough that the sequence appears random, even though it's following strict rules.
seed ā [scramble] ā numberā
numberā ā [scramble] ā numberā
numberā ā [scramble] ā numberā
...
The beauty of mulberry32 is its periodāthe length before the sequence repeats. For a 32-bit generator, that's about 4.3 billion numbers before you'd see a repeat. For everyday decision-making, that's effectively infinite.
Why Not Use "True" Randomness?
True randomness exists. It comes from physical processes: radioactive decay, atmospheric noise, quantum fluctuations. Services like random.org measure atmospheric radio noise to generate truly random numbers.
So why don't we use that?
- It's slow. Measuring physical randomness takes time. PRNGs are instant.
- It's not reproducible. True randomness means you can't share results via permalink.
- It's unnecessary. For deciding what to eat for lunch, pseudorandom is perfect.
True randomness matters for cryptography, gambling, scientific simulationsāplaces where predictability would be catastrophic. For our team generator or coin flip? Pseudorandom is actually better.
The Statistical Tests
Good PRNGs pass rigorous statistical tests. These tests check for patterns:
- Uniformity: Are all numbers equally likely?
- Independence: Does knowing one number help predict the next?
- No patterns: Do sequences avoid obvious repeating structures?
Algorithms like mulberry32 pass these tests. Bad PRNGs (like rand() in old C libraries) often fail spectacularly, producing visible patterns if you graph their output.
How We Use It
When you use our tools, here's what happens behind the scenes:
Spinner
We generate a random float between 0 and 1, multiply by the number of items, and round down. Item at that index wins. The spinning animation is just theaterāthe winner is decided the moment you click.
Number Generator
We generate random floats, scale them to your min-max range, and round to integers. For "unique numbers" mode, we keep generating until we have enough distinct values.
Team Generator
We shuffle the member list using the Fisher-Yates algorithm (which relies on our PRNG), then distribute members round-robin across teams. Same seed = same shuffle = same teams.
Coin Flip & Yes/No
Generate a number, check if it's above or below 0.5. Simple, clean, binary.
The Philosophical Bit
Is pseudorandomness "real" randomness? Philosophers and mathematicians debate this.
Here's a practical take: If you can't predict it, it's random enough. The determinism only matters if you know the seed and algorithm. Without that knowledge, a PRNG is indistinguishable from true randomness.
It's like a magic trick. Knowing the secret doesn't make the illusion less impressiveāit makes you appreciate the craft. PRNGs are mathematical illusions so good they fool statistical tests designed to expose them.
When Pseudorandom Isn't Enough
Use pseudorandom generators for:
- Everyday decisions and choices
- Games and entertainment
- Team assignments and fair selection
- Sampling and randomization in non-critical contexts
Don't use them for:
- Cryptographic keys or passwords
- Gambling or lotteries (legally required to use certified RNGs)
- Security tokens or authentication
- Scientific simulations requiring statistical rigor
For those cases, use cryptographically secure RNGs (CSPRNGs) or true random number generators. They're designed to be unpredictable even if an attacker knows some of the output.
The Takeaway
Computers can't be truly random, but they can fake it brilliantly. Pseudorandom number generators use deterministic math to create sequences that pass every test for randomnessāexcept perfect unpredictability.
For deciding between pizza and tacos, that's more than good enough.
And honestly? The fact that we can encode randomness in a formula, share it via URL, and reproduce exact results across devicesāthat's arguably cooler than true randomness anyway.
Try It Yourself
Want to see deterministic randomness in action? Use our number generator and save the permalink. Open it in different browsersāsame results every time.
Try the Number Generator ā