Random Number Generator
Generate one or more random numbers in any range, using your browser's cryptographically secure random number source.
How the randomness works
Numbers are generated using the Web Crypto API's crypto.getRandomValues(), the same cryptographically secure randomness source used for encryption keys, with rejection sampling to avoid the small statistical bias that a naive Math.random() % range approach can introduce.
Common uses
- Picking a winner from a numbered list of entries
- Generating sample data for testing
- Settling a decision or assigning random order
Worked examples
- Lottery-style pick: range 1 to 49, 6 numbers, duplicates off. There are 13,983,816 possible sets of six, and the numbers come out in the order drawn, not sorted.
- Two dice: range 1 to 6, 2 numbers, duplicates on.
- Raffle: tickets numbered 1 to 250, 3 winners, duplicates off, so no ticket can win twice.
- Why the duplicate switch matters: drawing 5 numbers from 1 to 10 with duplicates allowed has a 69.76% chance of at least one repeat, because 1 − (10 × 9 × 8 × 7 × 6) ÷ 10^5 = 0.6976.
Rules of the tool
- Both ends of the range are included, the minimum must not exceed the maximum, and the results appear as a comma-separated list.
- The count is kept between 1 and 1,000, and a larger number you type is reset to 1,000. Asking for more unique numbers than the range holds, such as 20 from a range of 10, shows an error instead of repeating values.
- The minimum and maximum must be whole numbers; a decimal such as 1.5 shows a message, and so does a minimum above the maximum.
- Bounds can be any whole numbers from -9,007,199,254,740,991 to 9,007,199,254,740,991, so a range such as 1 to 5,000,000,000 works. Larger values can't be represented exactly and are rejected.
- With duplicates off, only the numbers already drawn are tracked, so even a very wide range stays fast.
Fair, but not an audit trail
Every value in the range has the same chance, and the random source is the one used for cryptographic keys. Nothing is recorded or verifiable afterwards, though, so for a prize draw, lottery or giveaway that must be provable, use a method the organizer or a regulator accepts. Rules for lotteries and sweepstakes differ by country and, in some places, by state or province.
Frequently asked questions
Is this fair for picking a raffle or contest winner?
Yes — it uses the Web Crypto API's cryptographically secure random source with rejection sampling to avoid statistical bias, so every number in your range has an equal chance of being picked.
What happens if I ask for more unique numbers than the range allows?
The tool shows an error rather than silently repeating numbers — for example, you can't get 20 unique numbers from a range of only 10.
Can it generate decimals or negative numbers?
Negative whole numbers work, so a range of -10 to 10 is fine. Decimals aren't supported: a decimal minimum or maximum shows a message. Generate whole numbers and divide, for example by 100.
Is there a limit on the range or the count?
The count is limited to 1 to 1,000. The minimum and maximum can be any whole numbers up to 9,007,199,254,740,991 in size, positive or negative, so very wide ranges work. Beyond that, numbers can't be represented exactly and are rejected.
Can I get the numbers sorted?
Results are shown in the order they were drawn. Copy them into a spreadsheet or text editor if you need them sorted.