Random Number, Dice and Coin Generator
Pick random whole numbers in a range, roll dice, flip coins, or draw numbers without repeats. Results come from your browser's secure random source, and every value is equally likely.
Random numbers in a range
Dice
Coin flips
Draw without repeats
How to use
- Random numbers. Enter the lowest and highest value (both can be included in the result), choose how many numbers you want, from 1 to 100, and press Generate numbers. The same number can appear more than once.
- Dice. Choose 1 to 20 dice and 2 to 100 sides on each, then press Roll dice. The faces are listed and the total is shown.
- Coin flips. Choose 1 to 100 flips and press Flip coins. Each result is heads or tails.
- Draw without repeats. Enter a range and how many values to draw, then press Draw numbers. Each value comes up at most once, like pulling numbered balls from a bag.
If an entry is not a whole number or is out of range, the result line says what to fix.
Worked example
Random output changes every time, so these examples show the arithmetic behind it instead of one result.
- A six-sided die. The range 1 to 6 holds 6 values. The 32-bit source has 4,294,967,296 values, and 4,294,967,296 mod 6 is 4. So the 4 values at the very top are discarded and drawn again, which happens about 9 times in 10 billion. The other 4,294,967,292 values divide evenly into six groups, so each face has exactly the same chance.
- Two dice. The total runs from 2 to 12, but not evenly. A total of 7 can be made 6 ways out of 36 (about 16.7%), while 2 and 12 can each be made only 1 way (about 2.8%). Each die is fair. The totals are not.
- Drawing 3 from 1 to 10. There are 10 x 9 x 8 = 720 ordered results, and 120 different sets of three.
- A 6 from 49 draw. Drawing 6 values from 1 to 49 without repeats has 13,983,816 possible sets.
How it works
Random source. Every value comes from your browser's secure random source (crypto.getRandomValues), in 32-bit unsigned whole numbers. Nothing else supplies the randomness. It is documented on MDN and in the W3C Web Cryptography API. Browsers seed it from the operating system, so it is suitable for security work as well as games. It is not the same as Math.random(), which is not designed to be unpredictable.
Every value is equally likely. A range of values is picked from the 32-bit numbers by rejection sampling. A number that falls in the uneven leftover part of the 32-bit range is discarded and another one is drawn, so no value is favoured. Taking a simple remainder instead would favour the low values slightly. Dice and coin flips use the same rule.
Dice and coins. Each die is a number from 1 to its sides. Each coin flip is one random bit: an even value is heads and an odd value is tails.
Draws without repeats. The values in the range are shuffled into a random order (Fisher-Yates shuffle), and the first ones are taken. Each value appears at most once. Every order is equally likely.
Limits. Numbers and coin flips come 1 to 100 at a time. Dice have 1 to 20 dice with 2 to 100 sides. A range for random numbers can hold up to 4,294,967,296 values. A draw without repeats works on a range of up to 10,000 values.
Common mistakes
- Expecting streaks to even out. Five heads in a row does not make tails more likely next. Each flip is independent.
- Using "Generate numbers" for a raffle. That mode can repeat values. Use "Draw without repeats" when each number can win only once.
- Off-by-one ranges. The highest value is included. 1 to 10 can give 10.
- Treating it as legal or regulated randomness. For gambling, lotteries or regulated draws, follow the rules of the body that runs them. This page is for everyday choices, games and teaching.
- Judging fairness from a few results. Short runs look uneven by chance. Fairness shows over many results.
Frequently asked questions
Is it truly random?
It uses the browser's cryptographically secure generator, which is designed to be unpredictable. Strictly it is pseudorandom, seeded from the operating system's entropy, and that is the standard used for security.
Can I get the same result again?
No. There is no seed to set, so results cannot be replayed. Copy the result if you need it later.
Are the results stored or sent?
No. Everything runs in your browser and nothing is stored.
Why is the draw limited to 10,000 values?
A draw shuffles every value in the range, so a limit keeps the page fast and the memory use small.
Can I use it to pick a password?
For passwords, use the Password Generator. It is built for that job.