Random Number Generator
This free random number generator draws genuinely random whole numbers within any range you choose, entirely in your browser. Set a minimum, maximum, and how many numbers you want, choose whether duplicates are allowed, and your numbers appear instantly. Useful for raffles, dice rolls, picking a winner, or any time you need a fair, unpredictable pick.
How to Use It
- Enter a minimum and maximum value, and how many numbers you want.
- Choose whether to allow duplicate numbers.
- Your numbers appear instantly, or click "Generate New" for a fresh draw with the same settings.
How It Works
Every number is generated using your browser's Web Crypto API (crypto.getRandomValues()), the same cryptographically secure random source this site's Password Generator uses, never the weaker Math.random(). Mapping a raw random value onto your chosen range uses rejection sampling, discarding any draw that would land unevenly across the range, so every number between your minimum and maximum has exactly the same chance of appearing.
When duplicates are not allowed, numbers are drawn one at a time and any repeat is discarded and redrawn, the same way pulling raffle tickets out of a hat without replacing them works. This stays fast even when the range is huge and the count requested is small, since only the actual duplicates get redrawn, not the whole range reshuffled.
A worked example: asking for 5 unique numbers between 1 and 49 (a typical lottery-style range) might draw something like 7 18 22 35 41. Run it again with the same settings and you'll get a different set, since each draw is independent and none of your settings change what comes next.
Everything happens on your device. No number this tool generates is ever sent over the network, logged, or stored anywhere.
Frequently Asked Questions
Why use crypto.getRandomValues() instead of Math.random()?
Math.random() is fast but not designed to be unpredictable or evenly distributed at a rigorous level, it's meant for things like animations or games where a subtle statistical bias is invisible. crypto.getRandomValues() is the Web Crypto API's cryptographically secure random source, the same one this site's Password Generator uses, and it's the right choice whenever a result claims to be genuinely fair, like drawing a raffle winner or rolling for a decision.
What does "Allow duplicate numbers" actually change?
With it checked, each number is drawn independently, so the same value can come up more than once, the way rolling a die multiple times can land on the same face twice. Unchecked, every number in the result is guaranteed unique, like drawing raffle tickets out of a hat without putting them back. Unchecking it also means the count you request can never exceed how many possible values exist in your range.
Why is there a maximum count and range size?
The 10,000-number and roughly billion-value limits exist so the underlying math (avoiding statistical bias when converting a random value into your chosen range) stays reliable, not because of an arbitrary restriction. Both limits are far beyond what a real use case like picking lottery numbers, rolling dice, or sampling a small group actually needs.
Are these numbers actually random, or do they just look random?
They're generated to be genuinely, uniformly random within your chosen range, not merely random-looking. A naive way to map a random value onto a range (like a plain modulo operation) can subtly favor some numbers over others, called modulo bias, unless the range divides evenly into the size of the random value's underlying space. This tool uses rejection sampling instead: it draws a fresh random value and discards any draw that would introduce that bias, repeating until it gets a fair one, so every number in your range has exactly the same chance of appearing.
Can I generate negative numbers?
Yes. Minimum and Maximum both accept negative values, as long as Minimum is less than or equal to Maximum. A range like -10 to 10 works exactly the same way as any other range.
What happens if I request more unique numbers than my range allows?
You'll get a clear error instead of an incomplete or incorrect result. For example, asking for 10 unique numbers from a range of 1 to 5 is asking for more distinct values than exist (only 5 are possible), the same way you can't draw 10 unique raffle tickets from a hat that only has 5 tickets in it.