What This Generator Does
Set a minimum, a maximum, and how many numbers you want — then choose whether repeats are allowed:
- With repeats (independent draws): like rolling dice — the same value can appear twice.
- Without repeats (unique draws): like pulling raffle tickets from a hat — each value appears at most once.
That single toggle covers most real uses: raffle winners, random team assignment, sampling rows from a spreadsheet, picking lottery-style sets, dice substitutes, and settling who does the dishes.
How Computers "Roll Dice"
Browsers generate randomness two ways:
- Pseudorandom (PRNG): deterministic algorithms producing statistically random-looking streams — excellent for games, sampling, and simulations.
- Cryptographic (CSPRNG): OS-entropy-seeded generators (
crypto.getRandomValues) — unpredictable enough for security use, and what our Password Generator uses.
Getting a fair range needs care too: naive modulo arithmetic (big % range) subtly favors low numbers when the range doesn't divide evenly. Correct implementations (like this one) scale or reject to keep every value in your range equally likely.
Randomness Intuition: What Fair Actually Looks Like
- Streaks are normal: in 100 coin flips, a run of 6+ heads is more likely than not. Real randomness looks "clumpy"; suspiciously even spreads are the fake ones.
- No memory: a number being "due" is the gambler's fallacy — each draw is fresh, and 7 not appearing lately changes nothing.
- Birthday surprise: among just 23 random picks from 1–365, a duplicate is more likely than not — why "no repeats" mode exists for raffle-style draws.
- Small samples lie: 10 draws can look wildly skewed and still be fair; uniformity emerges over hundreds, not handfuls.
Fair-Use Patterns
| Task | Setup |
|---|---|
| Raffle with 250 tickets | 1–250, unique, draw the number of winners |
| Random sample of 20 rows from 500 | 1–500, unique, 20 draws |
| Dice (d6, d20…) | 1–6 or 1–20, repeats allowed |
| Assign 30 people to 3 teams | Draw 1–30 unique; first ten team A, etc. |
| Order-of-play / who goes first | One draw per person, highest wins |
For transparency in group settings, announce the rules before generating — range, number of draws, and tie handling — so the outcome can't be relitigated. Probability questions behind the draws live in the Statistics Calculator's territory.
The Bottom Line
Fair random draws are a solved problem — range, count, repeat rule, generate. The part humans get wrong is the intuition: streaks are normal, nothing is ever "due," and small samples mislead. Set the rules first, let the generator pick, and the outcome is as defensible as arithmetic.