How Random Number Generators Work and Why Fair Picks Matter
Developer · October 17, 2026 · 2 min read
Computers are predictable machines, so getting random numbers from one takes some care. For a game night it hardly matters, but for a prize draw or a password, how the numbers are made does.
Two kinds of randomness
Most programming languages have a simple generator that produces numbers that look random but follow a formula, so someone who knows its state can predict what comes next. Browsers also provide a secure generator, fed by unpredictable events in the device, which is built for things like encryption keys. The tools on this site use the secure one, so nobody can guess the next result.
A bias that is easy to introduce
A common shortcut maps a big random number onto a small range using the remainder. If the big range doesn't divide evenly, some results come up slightly more often. A careful generator throws away the few values that would cause the lopsidedness. The Random Number Generator does this, so every number in your range has an equal chance.
Picking without repeats
To draw several different numbers or names, like pulling tickets from a hat, shuffle the whole list and take from the top. Picking again and again at random would sometimes repeat. The Random Name Picker uses a fair shuffle to choose a winner or to split people into teams.
What dice and coins really do
- A fair coin lands on each side half the time, and a streak of heads doesn't make tails more likely next.
- A single six-sided die gives each number an equal chance.
- Two dice added together aren't equal: 7 is the most likely total, with 6 of the 36 combinations, while 2 and 12 have just one each.
- The Dice Roller lets you try these ideas, roll game dice and keep a history.
Random IDs
A random identifier is only useful if two never match. A version 4 UUID has 122 random bits, so a clash is astronomically unlikely, and the UUID Generator makes them with the secure generator too.