Why a random number generator keeps repeating numbers
Repeats are normal in real randomness: pick 12 numbers from 1 to 100 and a repeat is a coin flip. When to worry, and how to draw without duplicates.
Published
Tools for this job: Random Number Generator · Password Generator
Repeats are a normal part of randomness. Drawing 12 numbers from 1 to 100, the chance of at least one repeat is about 50%, and streaks are common too. A generator that never repeated would be less random. If each number must appear only once, as in a raffle, switch duplicates off.
Why repeats come sooner than you expect
It is the same maths as the birthday problem. The question is not “will this particular number come up again?” but “will any two of my numbers match?” — and the number of possible pairs grows quickly.
- 10 numbers from 1 to 100: about a 37% chance of a repeat.
- 12 numbers from 1 to 100: about 50%.
- 10 numbers from 1 to 10, one after another: about a 61% chance that the same number comes up twice in a row at least once.
Streaks are normal too
In 20 fair coin flips, the chance of a run of at least four heads or four tails in a row is about 77%, and of five or more about 46%. People asked to write down “random-looking” sequences avoid streaks and alternate too often. Real randomness looks clumpier than our intuition says it should.
When repeats are a problem
For a prize draw, picking students, assigning tasks or choosing lottery-style numbers, a repeat is not wrong mathematically but is wrong for the job. The fix is to draw without replacement: once a number is picked, it cannot be picked again.
- Open the Random Number Generator.
- Set the lowest and highest values — for 30 entrants, 1 to 30.
- Choose how many numbers you need and turn duplicates off.
- Generate, then copy or record the result.
Numbers come from your browser’s cryptographic random generator, with rejection sampling so every value in the range is equally likely and both ends can be drawn. For a draw others need to trust, see how to pick a random winner fairly.
When you should be suspicious
- The exact same sequence every time you load a page or run a program. That suggests a generator started from a fixed seed — common in games and simulations, wrong for draws or security.
- Some numbers never appear over hundreds of draws, or the ends of the range come up less often than the middle. That points to a biased method, such as rounding a random decimal instead of flooring it.
- A pattern you can predict. Weak generators can repeat in cycles. For passwords and tokens, only a cryptographically secure generator is acceptable — the Password Generator uses the same browser source as the number generator.
Recording a draw
For a draw that matters, number the entries in a fixed list first — alphabetical, or in order of entry — and share the list before drawing. Then the only thing the generator decides is the number, and anyone can check that number 17 on the published list is the winner. Do the draw once, in front of witnesses or on a recorded call if possible.
“Shuffle” that does not feel random
Music apps have been known to adjust truly random shuffles because listeners complained when the same artist played twice in a row. A shuffle designed to feel random spreads things out on purpose; a truly random one does not. Neither is broken — they are doing different jobs.
Mistakes to avoid
- Re-running a draw because the result “doesn’t look random”; that biases the outcome.
- Allowing duplicates in a draw where each entrant can win only once.
- Using a seeded or predictable generator for anything with money or security attached.
Checklist
- Repeats acceptable for this job? If not, switch duplicates off.
- Range set correctly, including both ends?
- Result recorded before anyone sees it, for a public draw?