This generator picks one whole number between a minimum and a maximum, with both ends included and every value equally likely. It is useful for picking a winner from a numbered list, assigning random seats, choosing a page to study or deciding who goes first.
How to use the Random Number Generator calculator
- Enter the smallest allowed value in Minimum integer. Negative numbers are fine.
- Enter the largest allowed value in Maximum integer. It must be equal to or larger than the minimum.
- Run the calculator to draw one number. Run it again for another independent draw.
How the random number generator calculation works
Where the randomness comes from
The tool uses the browser's Web Crypto function crypto.getRandomValues, which the MDN reference describes as a source of cryptographically strong random values. That is a stronger source than Math.random, which MDN classifies as non-cryptographic. If your browser lacks Web Crypto, the tool reports an error rather than falling back to a weaker method.
A naive approach takes a random 32-bit number modulo the range size, but that slightly favors low values whenever the range does not divide 2³² evenly. This generator throws away draws from the uneven top slice and tries again, a technique called rejection sampling, so every value in your interval has the same chance.
Limits and repeated draws
Both bounds must be whole numbers, and the interval can contain at most 2³² (about 4.29 billion) values. Each draw is independent, so the same number can come up twice in a row. For a raffle where each ticket can only win once, cross off the drawn number and draw again, ignoring repeats.
Results are not stored or logged, and the same inputs will not reproduce the same draw. That makes the tool unsuitable when you need an audit trail, such as an official prize drawing, or a fixed seed for a repeatable simulation.
Worked example
Minimum integer: 7 · Maximum integer: 7
- The interval 7–7 contains 7 − 7 + 1 = 1 possible value.
- Every draw must land on that single value.
- For a real draw, widen the interval: 1 to 30 contains 30 − 1 + 1 = 30 values, each with a 1-in-30 chance.
Result: 7
Assumptions and limits
Browser Web Crypto required. Not a lottery, audit log or reproducible simulation; no guarantee of distinct repeated draws.
Formula and worked examples last checked November 20, 2026. Spotted a problem? Report an error.
Frequently asked questions
Can the minimum and maximum themselves be picked?
Yes. The interval is inclusive, so a range of 1 to 6 behaves like a fair die with six possible outcomes, each with probability 1/6.
Can I generate a random number with decimals?
Not directly. Scale the range instead: to get a value from 0 to 1 in steps of 0.01, draw from 0 to 100 and divide the result by 100.
How do I pick several numbers without repeats?
Draw one number at a time and skip any value you have already recorded. For picking 5 from 50, the chance that a given draw repeats an earlier one stays small, so few redraws are usually needed.
Is this suitable for passwords or encryption keys?
The underlying source is cryptographically strong, but a single number from a small range is far too easy to guess for a password. Use a password manager or a dedicated key generator for secrets.