Random Number Generator 🎲
Set the lowest and highest value, say how many numbers you want, and the generator draws them at random. Every number in the range is equally likely on every draw.
Related calculators
Created by the Reeliy Editorial Team. Last updated: Oct 19, 2026
How to pick a random number between two numbers
- Enter the smallest allowed value in Range from and the largest in to. Both ends are included, so a range of 1 to 6 can return 1 and can return 6.
- Enter How many numbers? The default is one; you can ask for up to 1,000 at a time.
- When you ask for more than one number, decide about No repeats. Ticked, every number in the answer is different. Unticked, the same number can come up more than once, just as a die can show a six twice in a row.
- Press the button. The numbers appear in the order they were drawn, separated by commas.
- Only whole numbers are drawn. The lower bound can be 0 or more, the upper bound can be as large as 10,000,000,000,000,000,000 (ten quintillion, 1019), and large values are handled exactly rather than rounded.
- The lower bound must not be above the upper bound. A range with both ends equal is allowed and always returns that value.
- With No repeats ticked, the range must contain at least as many numbers as you asked for. Drawing 5 different numbers from 1 to 3 is impossible, and the generator says so.
- Each press is a fresh, independent draw. Nothing carries over from the previous result.
The No repeats box only matters for two or more numbers. It makes no difference when you draw a single value.
Where random numbers are useful
- Games and classrooms. Replace dice, pick a student by roll number, or choose who goes first.
- Raffles and giveaways. Number the entries from 1 to N and draw the winners without repeats, so nobody wins twice.
- Sampling. Select which records to audit or survey by drawing their row numbers from a numbered list. For fair groups of people see the random team generator.
- Testing and simulation. Produce sample inputs for software tests, seed values or quick Monte Carlo experiments.
- Decisions. Settle a tie, pick a restaurant from a numbered list, or choose a page of a book.
For other kinds of random output there are companion tools: the random letter generator, the random string generator, and the general-purpose randomizer.
How the numbers are generated
The generator asks the cryptographic random source built into your browser (crypto.getRandomValues) for raw random bits, and only falls back to the ordinary Math.random function if that source is unavailable. To turn bits into a number between two limits it uses rejection sampling: it draws just enough bits to cover the range and throws away any value that falls outside it. That avoids the small bias you get from the common shortcut of taking a remainder (x mod n), which makes some numbers very slightly more likely than others whenever the range does not divide the generator's output size evenly.
When repeats are not allowed, small ranges are handled by shuffling: each draw takes one of the not-yet-used numbers, so every selection of distinct numbers is equally likely. For very wide ranges the generator simply redraws on the rare occasion a number repeats.
True random versus pseudo-random numbers
A true random number generator measures an unpredictable physical process: thermal noise in a circuit, the timing of radioactive decay, atmospheric noise, or tiny variations in how long hardware events take. Its output cannot be reproduced even by someone who knows everything about the device.
A pseudo-random number generator (PRNG) is an algorithm that stretches a short starting value, the seed, into a long sequence that passes statistical tests for randomness. Run it again with the same seed and you get exactly the same numbers. Fast general-purpose algorithms such as the Mersenne Twister are fine for simulations but are predictable once enough output has been observed, so they must not be used for secrets.
Operating systems bridge the two worlds with a cryptographically secure generator: a well-vetted algorithm that is continually re-seeded from hardware and system entropy. Its output cannot practically be predicted, which is the property that matters for fairness and security, and it is what browsers expose through crypto.getRandomValues. Whether the entropy ultimately comes from a physical source or from system events, the draws here are suitable for games, raffles, sampling and everyday decisions. They are not a certified source for gambling regulators or for generating encryption keys.
Repeats happen more often than you expect
If repeats are allowed and you draw n numbers from a range of N values, the chance that all of them are different is (N ÷ N) × ((N − 1) ÷ N) × … × ((N − n + 1) ÷ N). The chance of at least one repeat is one minus that. Intuition usually underestimates it, which is the idea behind the birthday paradox: with just 23 people there is a 50.7% chance that two share a birthday.
| Numbers drawn (n) | Chance of a repeat |
|---|---|
| 3 | 3.0% |
| 5 | 9.7% |
| 10 | 37.2% |
| 15 | 66.9% |
| 20 | 87.0% |
| 25 | 96.2% |
A quick smaller example: drawing 5 numbers from 1 to 10 with repeats allowed gives all-different results only 10 × 9 × 8 × 7 × 6 ÷ 105 = 30.24% of the time, so about seven runs in ten contain a repeat. If you need distinct numbers, tick No repeats rather than redrawing by hand.
Remember too that independent draws have no memory. A number that has just come up is no more or less likely next time, and a streak of low numbers does not make high ones "due". Genuine randomness looks streakier and clumpier than people expect. To count the possible arrangements of a draw see the permutation calculator and the combination calculator.
Frequently asked questions
Is the random number generator really random?
It draws from the cryptographic generator in your browser, whose output cannot practically be predicted, and it removes modulo bias by rejection sampling. For games, raffles, sampling and everyday decisions that is as random as it needs to be.
How do I get random numbers with no duplicates?
Set how many numbers you want to more than one and leave the No repeats box ticked. The range must contain at least that many values.
Can I draw decimals or negative numbers?
No. The generator returns whole numbers from 0 upward. To get decimals, draw a whole number from a larger range and divide: for a value between 0 and 1 with three decimals, draw 0 to 1000 and divide by 1000. For negative ranges, draw from 0 to the width of the range and subtract the offset.
What is the largest range I can use?
The upper bound can be up to 1019, and up to 1,000 numbers can be drawn at once. Large values are computed exactly.
Can I use it to pick lottery numbers?
Yes, for choosing your own numbers, for example six different numbers from 1 to 49. Every combination is equally likely, which also means no pattern improves your odds.
References
- Knuth, D. E. (1997). The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd ed. Addison-Wesley.
- NIST Special Publication 800-90A Rev. 1 (2015). Recommendation for Random Number Generation Using Deterministic Random Bit Generators.
- Matsumoto, M., Nishimura, T. (1998). Mersenne Twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation 8(1), 3–30.
Cite this calculator and page
If you use this page in your work, you can cite it as:
Reeliy Editorial Team. (2026). Random Number Generator 🎲. Reeliy. https://reeliy.com/calculators/random-number-generator“Random Number Generator 🎲.” Reeliy, 2026, https://reeliy.com/calculators/random-number-generator.