Random Number Generator
Generate random whole numbers or decimals in a range, with or without repeats, sorted or unsorted, using a cryptographically secure random source.
How to use this calculator
- 1Set the minimum and maximum bounds, and how many numbers you want.
- 2Switch to decimals if you need fractional values, and set how many decimal places to round to.
- 3Turn off repeats for things like drawing lottery numbers or unique IDs from a small set.
How the calculation works
Number = Minimum + random() × (Maximum − Minimum + 1) — floored for whole numbers, rounded to the chosen precision for decimals- random()
- A uniformly distributed value in [0, 1) from a secure random source
Without repeats, this uses a partial Fisher-Yates shuffle rather than "generate and check for duplicates" — the naive approach gets slower and slower as the pool of remaining unique values shrinks, while Fisher-Yates stays fast and unbiased.
"Allow repeated numbers" only applies to whole numbers. For decimals, exact repeats are already vanishingly unlikely across a continuous range, so there is no separate uniqueness pass.
Worked example
5 numbers between 1 and 100
- 1.Each number is drawn independently and uniformly from 1 to 100 inclusive — the actual values differ every time you generate them, which is the point of a random number generator.
Result: 5 independent random numbers from 1–100
What "random" actually means here
A number generator is random when every possible outcome in its range is equally likely, and knowing the previous results gives no edge in predicting the next one. Computers cannot produce true randomness from pure arithmetic alone — a formula that is deterministic will always be, in principle, predictable — so they instead draw on either a mathematical pseudo-random algorithm or genuinely unpredictable physical noise, such as the tiny timing variations a computer’s hardware collects, to seed the process.
Where randomness is a working tool, not a toy
Beyond games and raffles, controlled randomness is a core technique across science and computing.
- Statistical sampling — drawing a genuinely random subset from a larger population is what makes a survey or experiment representative rather than biased.
- Simulations — Monte Carlo methods run a calculation thousands or millions of times with random inputs to model uncertainty in everything from finance to nuclear physics.
- Cryptography — secure keys and tokens depend on randomness that is not just statistically even but also unpredictable to an attacker, which is why cryptographic random generators are held to a much higher standard than ordinary ones.
- Load balancing and testing — software engineers use random inputs to stress-test systems and to randomly distribute traffic across servers.
A common misconception: the gambler’s fallacy
If a fair coin lands heads five times running, many people expect tails to be "due" on the sixth flip. It is not — each draw from a genuinely random process is independent of every draw before it, so the odds reset completely each time. The same logic applies here: a number that has not come up in a while is not more likely to appear next, and a number that just appeared is not less likely to appear again.
What this assumes, and where it stops
Assumptions
- Every number in the range is equally likely to be drawn, on each independent draw.
Limitations
- Uses the browser's Web Crypto API when available, which is suitable for games and sampling but this tool is not intended for generating cryptographic secrets like passwords or keys.
Common questions
Is this truly random?
It uses the Web Crypto API's cryptographically secure random number generator when your browser supports it (essentially all modern browsers), which is far higher quality than a typical pseudo-random generator like Math.random(). If that API is unavailable, it falls back to Math.random() and the result page tells you which source was used.
Can I generate the same number twice?
Yes, by default — each draw is independent, so repeats are possible just like rolling a die more than once. Turn on "allow repeated numbers" off to draw each value only once, useful for things like raffle numbers.
Formula and content last reviewed on .
Results are estimates for information only, not professional advice.
Related calculators
Tools people commonly use alongside the random number generator.