Random Number Generator
This random number generator picks whole numbers between any two values, up to 10,000 at a time, and every number in the range is equally likely. Set the lowest and highest number, say how many you need, and press Generate.
Sources: Web Crypto API Updated
How the random number generator draws a number
The generator counts how many whole numbers your range holds, draws a random position inside that count, and adds it to the lowest number.
values = highest − lowest + 1
result = lowest + r, where r is a random whole number from 0 to values − 1
The random position r has to be exactly even: no position may be more likely than another. A naive method (take a big random number and keep the remainder after dividing) favours the low positions slightly.
This page avoids that by throwing away the few draws that would cause the imbalance and drawing again. The random values themselves come from crypto.getRandomValues(), part of the Web Cryptography API.
How to draw a fair number from 1 to 6: a worked example
- The range 1 to 6 holds 6 values.
- The browser supplies a random 32-bit number, one of 4,294,967,296 possibilities. That is not a multiple of 6: dividing leaves a remainder of 4.
- So the top 4 possibilities (4,294,967,292 and above) are rejected. If one comes up, the page simply draws again. That leaves 4,294,967,292 possibilities, which split into 6 equal groups of 715,827,882.
- The accepted draw is divided by 6 and the remainder, 0 to 5, is the position r. Say the remainder is 3.
- Result = 1 + 3 = 4.
Each of the six results is backed by the same number of possible draws, so each has a chance of exactly 1 in 6. The chart below runs the same method 200,000 times on the range 1 to 20.
Chance of one particular number in common ranges
| Range | Values | Chance for each number |
|---|---|---|
| 1 to 2 | 2 | 50% |
| 1 to 3 | 3 | 33.3% |
| 1 to 4 | 4 | 25% |
| 1 to 6 | 6 | 16.7% |
| 1 to 10 | 10 | 10% |
| 1 to 20 | 20 | 5% |
| 1 to 50 | 50 | 2% |
| 1 to 100 | 100 | 1% |
| 1 to 1,000 | 1,000 | 0.1% |
Why random numbers repeat so often
When repeats are allowed, a duplicate appears sooner than most people expect. Drawing from 1 to 100:
| Numbers drawn | Chance that at least two are the same |
|---|---|
| 2 | 1.0% |
| 5 | 9.7% |
| 10 | 37.2% |
| 12 | 49.7% |
| 20 | 87.0% |
| 30 | 99.2% |
The chance is 1 − (100/100 × 99/100 × 98/100 × …), with one factor per number drawn. If you need every number to be different, for raffle tickets or seat numbers, switch on No repeats.
What people use a random number generator for
- Raffles and prize draws: number the tickets, set the range to match and draw with no repeats. To hand numbered tickets to a list of names, use the number generator with names.
- Classrooms: pick a student by register number or choose which exercise comes next.
- Sampling: draw row numbers from a spreadsheet to check a random sample.
- Games: replace a die you do not have. For several dice at once, the dice roller adds up the total.
Random Number Generator: FAQ
Are the numbers really random?
They come from crypto.getRandomValues(), the cryptographically secure generator built into your browser. It is seeded by your operating system and its output cannot be predicted in practice.
It is still a pseudo-random generator: the numbers are not measured from a physical process such as atmospheric noise, so we do not call them “true” random numbers. How our randomness works has the details.
How do I get random numbers from 1 to 100 with no repeats?
Keep the range at 1 to 100, enter how many numbers you need and tick No repeats. Each number can then come up only once, like drawing numbered balls from a bag without putting them back, and choosing Lowest first lists them in order. You cannot ask for more numbers than the range holds: 100 from 1 to 100, and only 10 from 1 to 10.
Are the lowest and highest numbers included?
Yes, both ends are included. A range of 1 to 10 can give 1, 10 or anything between.
Can I use negative numbers or decimals?
Negative whole numbers work: try −50 to 50. Decimals are not supported; the generator draws whole numbers only.
How large can the range and the count be?
The range can span up to 9,007,199,254,740,992 values (253), the limit for exact whole numbers in a browser. You can draw up to 10,000 numbers at a time.
Is anything saved?
Your last 10 draws are kept in your browser so you can look back at them. They are not sent anywhere, and the Clear button removes them.
Sources
- MDN: Crypto.getRandomValues() — the random source behind every draw (checked October 12, 2026)
- W3C: Web Cryptography API — the specification that defines getRandomValues (checked October 12, 2026)