How to use the random number generator
- Choose whole numbers or decimals.
- Enter the minimum and maximum. Both ends are included, so 1 to 6 can give a 1 or a 6.
- Choose how many numbers to draw, up to 10,000, and for decimals the number of decimal places.
- Tick No repeats to draw each value at most once, as in a raffle or a lottery. Tick Sort to list the results from smallest to largest.
- Press Generate new numbers for a fresh draw. Changing any setting also draws again. Copy the full list from the box under the result.
How the numbers are drawn
Here n is how many values are possible. The generator uses your browser's crypto.getRandomValues() function, the cryptographically secure source browsers use for encryption keys, rather than the simpler Math.random(). Each raw draw is a 32-bit number. Taking it "mod n" maps it onto your range, but only after throwing away draws from the uneven top slice. Without that step, some numbers would come up slightly more often than others, an error called modulo bias. Decimals work the same way on a grid of steps: two decimal places between 0 and 1 means the 101 values 0.00, 0.01 … 1.00.
Drawing without repeats shuffles the possible values with the Fisher-Yates method and takes the first ones, or for very wide ranges keeps drawing and skips any value already used. Either way, every set of numbers is equally likely.
Worked example
The generator starts with one whole number from 1 to 100:
- The range holds n = 100 − 1 + 1 = 100 values, so each has a 1 in 100 (1%) chance.
- The browser supplies a random 32-bit number, say 3,000,000,042.
- The cutoff is ⌊4,294,967,296 ÷ 100⌋ × 100 = 4,294,967,200. The draw is below it, so it is kept. A draw at or above the cutoff would be thrown away and replaced.
- 3,000,000,042 mod 100 = 42, and 1 + 42 = 43.
Your result will be a different number each time, anywhere from 1 to 100. If you set both the minimum and the maximum to 7, there is only one possible value, and the answer is always 7.
Repeats happen sooner than you think
When repeats are allowed, duplicates turn up surprisingly fast. Draw just 10 numbers from 1 to 100 and there is a 37% chance that at least two match. With 23 numbers from 1 to 365, the chance of a repeat passes 50%, which is the famous birthday problem.
| Draws from 1–100 | Chance of at least one repeat |
|---|---|
| 5 | 9.7% |
| 10 | 37.2% |
| 15 | 66.9% |
| 20 | 87.0% |
If duplicates would spoil your draw, such as picking raffle winners or assigning seats, tick No repeats.
Frequently asked questions
Is this truly random?
The numbers come from your device's cryptographically secure generator, which mixes in unpredictable hardware events. Nobody can predict the next number from the previous ones, which is the standard used for passwords and encryption keys. For games, raffles and classroom picks, it is as fair as rolling physical dice, and fairer than most.
Can I pick lottery numbers with it?
Yes. For a draw such as 6 numbers from 1 to 49, set the range to 1 and 49, choose 6 numbers and tick No repeats and Sort. Every combination is equally likely, so random picks win no more and no less often than any other. They do avoid popular patterns, which reduces the chance of sharing a prize.
Does it save or send the numbers anywhere?
No. The numbers are generated in your browser and stay on your screen. Nothing is stored, and this tool has no save option, because a fresh draw is the point.
How do I simulate dice or coin flips?
For a die, set the range to 1 to 6. For a coin, use 0 and 1 and call 0 heads and 1 tails. To roll several dice at once, set how many numbers you want and leave repeats allowed. The dice roller is built specifically for dice games.
Related calculators
- Dice Roller — Roll any number of d4, d6, d8, d10, d12, d20, d100 or custom dice with a modifier, and see the odds of your total.
- Probability Calculator — P(A and B), P(A or B) and P(not A) for independent events, at least one success in n tries, and binomial odds.
- Permutation and Combination Calculator — nPr and nCr, with or without repetition, as exact whole numbers even when they run to thousands of digits.
- Password Generator — Strong random passwords or word passphrases made in your browser, with the entropy and a strength rating for each.
Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.