Random Number Generator
Published Updated
Draw 1 to 1,000 whole numbers between any minimum and maximum within one trillion either side of zero, with or without repeats, from your browser's crypto random source.
Whole numbers, both ends included, every value equally likely
Set a minimum and a maximum and the tool draws whole numbers between them, the two ends included. One click gives up to 1,000 results, and the range can reach one trillion below or above zero, so a draw from -1,000,000,000,000 to 1,000,000,000,000 is allowed.
With Unique numbers ticked, the draw works like pulling tickets from a hat without putting them back. Under the hood it runs a partial shuffle that makes exactly as many picks as you request, so 1,000 unique values from a range of two trillion cost no more work than 1,000 from a range of 1,000.
Settings for everyday draws
Most uses come down to four fields:
| Draw | Minimum | Maximum | How many | Unique |
|---|---|---|---|---|
| Roll a die | 1 | 6 | 1 | Off |
| Toss a coin (0 heads, 1 tails) | 0 | 1 | 1 | Off |
| Lottery style, 6 from 49 | 1 | 49 | 6 | On |
| Raffle with 250 tickets, 3 winners | 1 | 250 | 3 | On |
| Random order for 30 people | 1 | 30 | 30 | On |
Where the randomness comes from
Every number starts as bytes from crypto.getRandomValues, which browsers back with a generator fit for cryptography. The familiar Math.random is not used; MDN warns it does not provide cryptographically sound numbers.
The tool reads as many bytes as the range needs: one for up to 256 values, six for the widest range of 2,000,000,000,001 values. Values from the uneven top end of the byte range are thrown away and drawn again, so no number gets an extra chance.
Drawing your numbers
Step 1
Set the range
Type a minimum and a maximum; both can come up. Decimals are rounded, and anything past one trillion either way is pulled back to that limit.
Step 2
Choose how many
Ask for 1 to 1,000 numbers. Tick Unique numbers when no value may appear twice in the batch.
Step 3
Generate and copy
Press Generate Numbers. Each result has its own copy button, and Copy All puts the list on the clipboard one number per line.
Running a draw other people must trust
The page keeps no log, and a reload clears the results. For a giveaway or a classroom pick, draw while people watch, or record the screen with the Online Screen Recorder so the moment can be replayed. Numbers drawn here are random, but nobody else can verify that afterwards.
For codes rather than draws, other generators fit better: the PIN Code Generator keeps leading zeros, and the Password Generator mixes letters, digits and symbols.
Random numbers: common questions
Are the minimum and maximum included?
Yes. A range of 1 to 6 returns 1, 2, 3, 4, 5 or 6 with equal chances, so it works as a die, and 0 to 1 works as a coin toss.
How does it avoid favouring some numbers?
It discards random values that would make the split uneven. For 1 to 100 it reads one byte, a value from 0 to 255, keeps 0 to 199 and draws again for 200 to 255, which happens about 22% of the time. Each of the 100 numbers then has exactly 2 chances in 200.
What if I ask for more unique numbers than the range holds?
You get a message instead of a short list, for example: Can't generate 20 unique numbers from a range of only 10 possible values. Widen the range or lower the count.
Can it pick lottery numbers?
It can draw 6 different numbers from 1 to 49, one of 13,983,816 possible sets, each as likely as the others. They come out in the order drawn, not sorted. No generator can raise your odds of winning.
Is this the same as Math.random?
No. Math.random is documented as unsuitable for anything security related. This tool reads crypto.getRandomValues, the browser's cryptographic generator, for every draw.
Why does the list show commas that the copy leaves out?
Results are displayed with your locale's digit grouping, such as 1,000,000, so long numbers are easy to read. Copying gives the plain digits, which paste cleanly into a spreadsheet or a script.