How Do Random Number Generators Work? RNG Explained Simply
Pseudo-random vs. truly random, why computers need algorithms to be unpredictable, and how to pick random numbers fairly for raffles and games.
Computers are built to be predictable: the same input always gives the same output. So how does a computer pick a “random” number? The answer is a random number generator, or RNG — and understanding the basics helps you choose the right tool for a raffle, a game or a password.
Pseudo-random number generators
Most software uses a pseudo-random number generator (PRNG). It starts from a seed value and runs it through a mathematical formula that produces a long sequence of numbers with no visible pattern. The sequence is technically deterministic — the same seed gives the same sequence — but without knowing the internal state, the next number is practically impossible to guess.
Modern browsers use fast, high-quality PRNGs for everyday randomness, which are fine for games and animations.
Cryptographically secure randomness
For security, “hard to guess” isn't enough — it has to be infeasible to predict, even for a determined attacker. Cryptographically secure RNGs mix in unpredictable data collected by the operating system. Browsers expose this through the Web Crypto API, and it's what you want for passwords, keys and tokens. All of our tools — from the name picker to the dice roller — use this cryptographically secure source.
Truly random numbers
Some services generate randomness from physical processes such as atmospheric noise or radioactive decay. For a raffle or a game, though, the real question isn't where the randomness comes from — it's whether every outcome has the same chance and whether the result can be verified.
Random numbers in a range
Turning raw random values into “a number between 1 and 100” has to be done carefully. A naive approach can make some numbers slightly more likely than others. Good implementations make sure every number in the range has exactly the same probability. To pick several different numbers, the fair approach is to shuffle the whole range and take the first few — like drawing numbered balls from a bag without putting them back.
Pick random numbers online
The Random Number Generator lets you set any minimum and maximum, choose how many numbers you need (up to 20 at once) and turn on “No Repeating Numbers” so every result is unique — perfect for numbered raffle tickets or lottery-style picks like 6 numbers between 1 and 49. Every result can be shared as a link.
Generate random numbersWhy people are bad at being random
Ask people to pick a number between 1 and 10 and 7 comes up far more often than it should. Between 1 and 100, people gravitate toward numbers that “feel” random, like 37 or 73, and avoid round numbers. That's exactly why a fair draw should never rely on someone thinking of a number.
More Articles
How to Organize a Secret Santa: The Complete Step-by-Step Guide
Everything you need to run a Secret Santa at work, with friends or with family: drawing names, budgets, rules and gift ideas.
How to Pick a Random Winner Fairly (and Prove It)
Picking a giveaway winner is easy; proving it was fair is the hard part. Here's how to draw a random winner your audience can actually verify.
How to Run an Instagram Giveaway: A Step-by-Step Guide
From writing the rules to announcing the winner, here's how to run an Instagram giveaway that grows your account without losing your followers' trust.