Random Number Generator
Generate random numbers, roll dice, flip a coin, or shuffle a list — pick your mode and generate instantly. 100% free.
What Is a Random Number Generator?
A random number generator (RNG) produces numbers that have no predictable pattern — each result is statistically independent of every previous one. This tool generates random integers or decimals in any range you set, rolls dice of any size, flips coins, or shuffles a list into a random order. All five modes use window.crypto.getRandomValues() — the browser's cryptographically secure random source — rather than the weaker Math.random() function.
Random numbers have practical uses far beyond games: statistical sampling, security key generation, randomized controlled trials, giveaway winner selection, seating assignments, blind taste tests, and classroom name picking. The core requirement in all these cases is the same — each outcome must have an equal probability with no influence from what came before.
How to Use This Tool
- 🔢 Numbers — set a min and max, choose integer or decimal, click Generate. Good for 1–10, 1–100, or any custom range.
- 📋 Multiple — generate a batch of numbers at once. Toggle "No duplicates" to avoid repeats (lottery-style picks). Toggle "Sort" to order results low to high.
- 🎲 Dice — roll 1–20 dice of any standard type: D4, D6, D8, D10, D12, D20, or D100. Shows each die face individually plus the total.
- 🪙 Coin — flip 1–100 coins at once. Shows heads/tails for each flip and a summary count.
- 🔀 List Shuffle — paste any list (one per line or comma-separated), get it back in a random order. Or toggle "Pick one" to select a single random item.
How RNG Actually Works
There are two fundamentally different types of random number generators. Understanding which type you're using matters for anything security-related.
Probability and What to Expect From a Random Range
Each number in a range has exactly equal probability. Here's what that means in practice across common ranges:
| Range | Total Outcomes | P(any specific number) | Common Use |
|---|---|---|---|
| 0–1 (coin flip) | 2 | 50.0000% | Decisions, binary choices |
| 1–6 (die roll) | 6 | 16.6667% | Board games, tabletop RPG |
| 1–10 | 10 | 10.0000% | Rating scales, quick picks |
| 1–52 (card deck) | 52 | 1.9231% | Card game simulation |
| 1–100 | 100 | 1.0000% | Percentile picks, raffle |
| 1–1,000 | 1,000 | 0.1000% | Large draws, sampling |
One counterintuitive result from probability: even with a perfectly fair generator, you'll see "streaks" — the same number appearing multiple times in a row. Getting the same number three times in a row when rolling a D6 feels suspicious, but the probability is (1/6)³ = 0.46% per set of three rolls — unlikely, but expected to happen roughly once in every 216 three-roll sequences. Streaks are a feature of true randomness, not a sign of a broken generator. Reference: Random.org — Introduction to Randomness
Dice Roll Probabilities
Rolling a single die gives equal probability for each face. Two dice together create a distribution skewed toward the middle — there are 6 ways to roll a 7 but only 1 way to roll a 2 or 12. Every value in the table below is computed from first principles (counting combinations out of 36 total two-dice outcomes):
| Sum (2d6) | Combinations | Probability | Rough Odds |
|---|---|---|---|
| 2 or 12 | 1/36 | 2.78% | 1 in 36 |
| 3 or 11 | 2/36 | 5.56% | 1 in 18 |
| 4 or 10 | 3/36 | 8.33% | 1 in 12 |
| 5 or 9 | 4/36 | 11.11% | 1 in 9 |
| 6 or 8 | 5/36 | 13.89% | 5 in 36 |
| 7 (most likely) | 6/36 | 16.67% | 1 in 6 |
A sum of 7 is six times more likely than rolling a 2 or 12 with two standard dice. This is why 7 is so central to games like Craps — it's the most probable single outcome from a 2d6 roll. Reference: Khan Academy — Basic Probability
Common Real-World Uses for Random Number Generators
Random number generation is one of the most widely applied tools in both everyday decisions and professional work. A few categories where it shows up:
- Giveaways and winner selection — assign numbers to entries, generate a random number in that range. Transparent and auditable.
- Research sampling — picking a random subset from a larger population for surveys, quality control audits, or clinical trials ensures the sample isn't unconsciously biased by the researcher's choices.
- Games and simulations — dice rolls, card shuffles, enemy spawn locations, procedural map generation — all rely on RNG for variety and replayability.
- Password and token generation — cryptographically secure random numbers are the foundation of secure passwords, session tokens, and one-time codes. This is specifically where PRNG (Math.random) fails and CSPRNG (crypto.getRandomValues) matters.
- Decision-making — when two options are genuinely equal, a coin flip or random number eliminates deliberation paralysis. Studies show that people are happier with randomly-made decisions for low-stakes choices than with overthought ones.
Lottery Odds — Random Picks vs Strategies
Lottery jackpot odds are combinatorial — not affected by which specific numbers you choose, since all combinations are equally likely. Here's what the math actually says:
| Lottery | Format | Jackpot Odds | P(winning) |
|---|---|---|---|
| Powerball (US) | 5 from 69 + 1 from 26 | 1 in 292,201,338 | 0.000000342% |
| Mega Millions (US) | 5 from 70 + 1 from 25 | 1 in 302,575,350 | 0.000000331% |
| 6 from 49 | 6 from 49 | 1 in 13,983,816 | 0.00000715% |
| Pick 3 | 3 digits 000–999 | 1 in 1,000 | 0.10% |
No number-picking strategy changes these odds — every combination of 5 numbers from 1–69 has exactly a 1 in 11,238,513 chance of being drawn, whether you pick birthdays, "lucky" numbers, or let a random generator choose. What the generator does is save you from unconsciously favoring numbers below 31 (common birthday bias) and ensures you don't share your combination with thousands of other players who pick the same "lucky" numbers. Reference: National Council on Problem Gambling — Lottery Odds
5 Smart Ways to Use This Random Number Generator
- Raffle draws: assign numbers first, then generate. Give each entry a unique number (1, 2, 3…), then generate a random number in that range. Screenshot the result before revealing it. This is more defensible than picking a name from a hat because the process is auditable — anyone can verify the range and result.
- Use Multiple mode with "no duplicates" for lottery picks. Generate 6 unique numbers from 1–49 for a lottery-style pick. The "no duplicates" checkbox uses rejection sampling internally — numbers already drawn are excluded from the pool, exactly replicating how physical lottery balls work.
- List shuffle for fair rotation of tasks or turns. Paste team member names and shuffle — whoever appears first takes the first turn, first slot on the schedule, or first pick. Beats the appearance of favoritism from any human-imposed order.
- Roll multiple D20 for tabletop RPG advantage/disadvantage. Set dice to D20, quantity to 2. Under advantage rules, take the higher result; under disadvantage, take the lower. Rolling 2d20 like this correctly simulates both rules.
- Generate in batches to see distribution over time. Generate 100 numbers from 1–10 using Multiple mode. You should see each number appear roughly 10 times, but rarely exactly 10 — actual frequency for any single value will typically fall between 5 and 15 per 100 draws. If you see a perfectly even distribution, that would actually be suspicious of a non-random generator.
Frequently Asked Questions — Random Number Generator
window.crypto.getRandomValues() — the browser's cryptographically secure random number generator. It draws entropy from hardware sources (CPU timing jitter, hardware noise registers) and is considered genuinely unpredictable, unlike Math.random() which is a deterministic algorithm. The result is indistinguishable from true randomness for any practical purpose, including security-sensitive applications.