How to generate random numbers
- Choose a mode. Under What to generate, pick Numbers, Dice or Pick.
- Set the range or dice. Enter a Minimum and Maximum and How many, or choose a die and How many dice, or paste your list.
- Decide on repeats. Turn on No repeats for raffles and team picking; leave it off for dice-style draws.
- Generate. Press Generate, then Copy results; the last 15 results are kept under History.
The three modes
| Mode | What it does | Limits |
|---|---|---|
| Numbers | Whole numbers from the minimum to the maximum (both included), or decimals between them | From −1,000,000 to 1,000,000, up to 500 numbers per draw |
| Dice | Rolls a set of identical dice and shows each roll and the total | d4, d6, d8, d10, d12, d20 or d100, up to 50 dice |
| Pick | Chooses entries from a list you type, one per line, never the same one twice | Up to as many as the list holds |
Advanced options in Numbers mode add up to six decimal places, an Order setting (As drawn, Low to high or High to low) and a seed. Sorting does not change which numbers were drawn, only how they are listed. With decimal places above zero, every value in the range is possible, so No repeats has no effect.
Why the random source matters
Math.random() is a pseudorandom generator: quick and fine for shuffling a screensaver, but its next value can in principle be predicted from earlier ones. The browser’s crypto.getRandomValues() is built for security work such as making encryption keys, and is the source this tool uses for every unseeded draw.
There is a second, quieter problem: turning a big random number into a small range. If a generator gave the values 0 to 9 and you took the remainder after dividing by 3 to get 0, 1 or 2, the result 0 would come from 0, 3, 6 and 9 (four ways) while 1 and 2 would come from only three ways each. That is called modulo bias. The generator here throws away the few raw values that would cause it and draws again, so the odds stay exactly equal.
With or without repeats
| Setting | Repeats possible? | Use for |
|---|---|---|
| No repeats on | No | Raffles, team picking, choosing several winners |
| No repeats off | Yes | Dice-style rolls, simulations, sampling with replacement |
Choosing the wrong one is the most common mistake. A raffle drawn with repeats allowed can pick the same ticket twice, and a simulation of dice that forbids repeats is no longer dice.
Running a fair draw
- Number the entries in a fixed order you can show people, such as ticket order.
- Announce the range and how many winners there will be before drawing.
- Set the Minimum and Maximum to match, turn on No repeats, and leave Use a seed off.
- Press Generate once, and screenshot or read out the result straight away.
- Do not draw again. A second draw replaces the first, and nobody can tell which one you would have kept.
For a small group it is often simpler to use Pick and paste the names directly, which removes the step of matching numbers to people.
Dice notation and totals
Tabletop games write dice as NdX: N dice with X sides each. One d20 gives every number from 1 to 20 with the same 5% chance. Several dice added together behave differently. Two d6 total anything from 2 to 12, but 7 can be made six ways out of 36 (a one in six chance) while 2 and 12 can each be made only one way. Three d6 run from 3 to 18 and average 10.5, with 10 and 11 the most likely totals. The Dice mode shows each die and the total, so you can use either.
Related tools
The password generator uses the same secure random source for passwords. For randomness on paper, the bingo card generator makes cards with different numbers on each, and the road trip games page has printable games for the journey.
Frequently asked questions
How random are the numbers?
crypto.getRandomValues(), the browser’s cryptographic random source, rather than Math.random(). Values that would make some results slightly more likely than others are thrown away and drawn again, so every whole number in your range has the same chance.