Random Number Generator
Pick random whole numbers in any range: one number or up to 1,000 at a time, with or without repeats, or raffle-style across several draws.
How to use
- Enter the lowest and highest number you want. Both are included, so 1 to 6 works like a die.
- Set How many numbers to draw (1 to 1,000).
- Untick Allow repeats to get all different numbers, like drawing raffle tickets. Tick Sort to list them from low to high.
- Press Generate, then Copy to copy the numbers separated by commas or one per line.
- Running a raffle or calling numbers one at a time? Tick No repeats across draws. Every number drawn is set aside until you press Reset, and the tool shows how many are left. Your last 10 draws are listed below the result.
- Copy link copies the page address with your range and options (not the numbers drawn), so the next person starts with the same settings.
How it works
Every draw starts with random bits from the browser's Web Crypto API (crypto.getRandomValues), a secure generator built into every modern browser. The tool takes 53 random bits at a time, enough to cover the whole allowed range exactly, because JavaScript numbers can hold whole numbers exactly only up to 253.
Avoiding modulo bias
To turn a random value into a number from 0 to n − 1, the simple method is the remainder x % n. That is only fair if the count of possible values divides evenly by n. If it doesn't, the smallest results get one extra chance. The tool uses rejection sampling instead:
Because a draw is only thrown away when it lands in the small leftover at the top, this almost never takes more than one try.
No repeats
For ranges up to 10,000 numbers, the tool shuffles the range with a Fisher–Yates shuffle (using the same unbiased draws) and takes the first numbers. For larger ranges it draws numbers and skips any it has already picked.
Raffle mode
With No repeats across draws on, the tool remembers every number it has drawn since the last reset. Each new draw is taken only from the numbers that are left, using the same shuffle or skip method, so a ticket can never come up twice and every remaining ticket has the same chance. The "left" count is the size of the range minus the numbers already drawn inside it.
Worked example
Why plain remainders are unfair: imagine a source with only 8 values (0–7) and a range of 3 outcomes. Using value % 3, outcome 0 comes from 3 values, outcome 1 from 3, and outcome 2 from only 2. Rejection sampling would discard values 6 and 7, leaving each outcome with exactly 2.
Rolling a die (1 to 6): size = 6, so limit = 253 − (253 mod 6) = 9,007,199,254,740,990. A 53-bit draw of 320,256,546,164,207 is below the limit, so it is kept: 320,256,546,164,207 mod 6 = 5, and the roll is 1 + 5 = 6.
A small raffle: tickets 1 to 10, drawing 3 at a time in raffle mode. With a fixed test input in place of the secure generator, the draws come out as 1, 9, 5 (7 left); then 7, 6, 2 (4 left); then 8, 4, 3 (1 left). A fourth draw of 3 is refused with: “Only 1 number is left in this range. Draw fewer, or press Reset to start over.”
Too many without repeats: asking for 12 different numbers from 1 to 10 gives the message: “Only 10 different numbers exist from 1 to 10, so you can't draw 12 without repeats.”
Limits
- Whole numbers only, from −1,000,000,000,000 to 1,000,000,000,000. No decimals.
- Up to 1,000 numbers per draw. Without repeats you can't ask for more numbers than the range holds.
- Results aren't sent or logged anywhere. The draw history and the raffle's set-aside numbers are kept in this browser tab only and are gone when you close it, so copy the numbers or take a screenshot if you need a record.
- In raffle mode, changing the range keeps the numbers already drawn; any that fall outside the new range simply don't count. Press Reset before starting a new raffle.
- Good for games, classrooms, sampling and everyday picks. It is not a certified generator for lotteries, gambling or regulated prize draws.
FAQ
Are the numbers truly random?
They come from your browser's cryptographically secure generator, which is seeded by the operating system and designed so results can't be predicted. That is far stronger than Math.random(), which many simple generators use.
Are the minimum and maximum included?
Yes. A range of 1 to 10 can return 1, 10 or anything in between, each with the same chance.
How do I pick lottery-style numbers with no repeats?
Set the range, set how many numbers you need, and untick Allow repeats. Tick Sort if you want them in order. For example, 1 to 69 with 5 numbers gives five different numbers.
What is modulo bias?
It is a small unfairness that appears when random bits are turned into a range with a plain remainder. If the number of possible random values isn't a multiple of the range size, the low results come up slightly more often. This tool discards those extra values and draws again, so every number is equally likely.
Can I get the same number twice in a row?
Yes, when repeats are allowed. Each draw is independent, so a repeat is normal and expected, especially in small ranges. Raffle mode is the way to rule that out across several draws.
How do I draw raffle winners one at a time?
Enter the ticket range, set How many to 1, and tick No repeats across draws. Each press of Generate picks one ticket that hasn't come up yet and shows how many remain. Press Reset when the raffle is over.