How to use the random number generator
- Numbers: enter a minimum and maximum (both included) and how many numbers you want, up to 10,000. Tick No repeats for a draw where each number can come up only once, like a raffle or lottery. Tick Sort to list them in order.
- Pick from list: paste names, one per line, and choose how many winners to draw. Winners are listed in the order they were drawn, so the first is the main prize. Or shuffle the whole list to set a random order.
- Coin flip: flip one coin, or up to 1,000, and see the count of heads and tails.
- Dice: roll 1 to 10 dice with 4, 6, 8, 10, 12 or 20 sides, and get the total.
Use Copy to paste the result into a chat, a spreadsheet or an announcement.
Is it truly random?
The numbers come from crypto.getRandomValues, the cryptographically secure generator built into every modern browser. The browser seeds it from your operating system, which gathers unpredictable data from the hardware. It is the same source used to make encryption keys. Nobody, including us, can predict or influence a result, and nothing is sent to a server.
Plain Math.random(), used by many simple tools, is fine for games but is not designed to be unpredictable. It is not suitable for anything with prizes or money at stake.
No bias: rejection sampling
The browser gives random 32-bit numbers, from 0 to 4,294,967,295. A naive way to get a number from 1 to N is 1 + (x % N). But unless N divides 4,294,967,296 exactly, some results come up slightly more often than others. This is called modulo bias.
Example: for N = 3 billion, values 0 to 1,294,967,295 can be reached in two ways with plain modulo, so the low third of the range would be twice as likely. Rejection sampling throws away any draw at or above the limit (3,000,000,000 here) and draws again. Every number from min to max then has exactly the same chance.
Odds for dice and coins
| Roll | Possible results | Chance of each | Average |
|---|---|---|---|
| Coin | Heads, tails | 1 in 2 (50%) | — |
| 1d4 | 1–4 | 1 in 4 (25%) | 2.5 |
| 1d6 | 1–6 | 1 in 6 (16.7%) | 3.5 |
| 1d8 | 1–8 | 1 in 8 (12.5%) | 4.5 |
| 1d10 | 1–10 | 1 in 10 (10%) | 5.5 |
| 1d12 | 1–12 | 1 in 12 (8.3%) | 6.5 |
| 1d20 | 1–20 | 1 in 20 (5%) | 10.5 |
| 2d6 (total) | 2–12 | 7 is most likely (1 in 6) | 7 |
The average of one die with S sides is (S + 1) ÷ 2. With several dice, totals near the middle are more likely, because more combinations add up to them.
Tips for fair giveaways
- Decide the rules and the number of winners before you draw, and say how duplicates are handled.
- Remove duplicate entries first if each person may enter once. The tool tells you when the list has duplicates.
- Record your screen or draw live, and post the winner list with the time shown under the result.
- Draw a few extra names in order as reserves, in case a winner doesn't reply.
Need a random password or ID instead? Use the password generator or the UUID generator.
Frequently asked questions
How do I pick a random number between 1 and 100?
Can I generate random numbers without repeats?
How do I pick a random winner for a giveaway?
Is this random number generator fair?
Can I use it for a lottery or a legal prize draw?
Last updated . How we check our tools.