—
—
Generating random numbers
A random number generator is useful whenever you need an unbiased pick — drawing raffle winners, assigning people to groups, sampling rows for a spot check, or simulating dice. This generator lets you set the range and how many numbers you want, and choose whether repeats are allowed, which is the difference between rolling dice and drawing names from a hat.
How to use the Random Number Generator
- Set the Minimum Value and Maximum Value; both are included in the range.
- Set the Quantity of numbers you need.
- Turn Allow Duplicates off for a draw, on for dice-style rolls.
- Generate as many times as you like.
Formula and a worked example
value = floor(random × (max − min + 1)) + min
The + 1 is what makes the maximum reachable; without it the top value could never appear. With duplicates off, each number drawn is removed from the pool, so the quantity cannot exceed the size of the range.
Worked example
Range 1 to 100, quantity 6, duplicates off — a lottery-style draw where no number can repeat. Range 1 to 6, quantity 2, duplicates on — a pair of dice, where double sixes are perfectly possible.
Frequently asked questions
Is this truly random?
It uses the browser's built-in pseudorandom generator. That is statistically sound for draws, sampling and games, but it is not cryptographically secure — do not generate keys with it.
Can I get the same number twice?
Only if Allow Duplicates is on. With it off, every number in the output is distinct.
Are the minimum and maximum included?
Yes, the range is inclusive at both ends.
Can I generate more numbers than the range holds?
Not with duplicates off — you cannot draw 10 distinct numbers from a range of 5. Either widen the range or allow duplicates.
Related calculators
Other tools people use alongside the random number generator.