How to use it
- Set Min and Max. Both are included, so 1 to 10 can give 1 or 10.
- Set How many numbers you want. Leave Allow repeats off if each number may only come up once, as in a raffle.
- Press Generate (or Enter). Choose an order if you want the results sorted.
- Press Copy to copy the results, separated by commas.
Why the numbers are fair
Computers produce random bits, not random numbers in your range, so they have to be converted. The common shortcut, taking the remainder after division, is slightly unfair. A 32-bit random value has 4,294,967,296 possible results, which does not divide evenly by 6, so a remainder-based "1 to 6" gives 1 to 4 a tiny bit more often than 5 and 6.
This generator uses rejection sampling instead: it throws away the few raw values at the top that would cause the imbalance and draws again. Every number in your range then has exactly the same chance. For very wide ranges it uses 53 random bits, so it stays fair all the way to ±9,007,199,254,740,991.
Drawing numbers without repeats
With Allow repeats off, each number can come up only once, like balls drawn from a bag. Use it for raffles (tickets 1 to 500, draw 3 winners), assigning seats or picking lottery-style numbers:
- Powerball: 5 numbers from 1 to 69, then 1 number from 1 to 26.
- Mega Millions: 5 numbers from 1 to 70, then 1 number from 1 to 24.
- EuroMillions: 5 numbers from 1 to 50, then 2 from 1 to 12.
A random pick has the same odds of winning as any other set of numbers, but you are less likely to share a jackpot, because people who choose their own numbers favor birthdays (1 to 31).
Questions
How random are the numbers?
crypto.getRandomValues), which is seeded by your operating system and is used for passwords and encryption keys. Each number in the range is equally likely, and earlier results tell you nothing about the next one.