Generate random whole numbers in a range you choose, in any quantity, with or without duplicates.
Example
A range of 1 to 100 contains 100 possible whole numbers, each with a 1% chance on every draw, while 1 to 6 behaves like a fair die with 16.67% for each face.
Calculation method
Both ends of the range are included. Values come from the browser’s cryptographically secure source with rejection sampling, so numbers at the top of the range are neither more nor less likely than the rest — a flaw found in some quick formulas.
Important notes
Only integers are produced. For a random decimal, generate an integer in a larger range and divide it, for example 1 to 1,000 divided by 100. A single request is limited to 1,000 numbers so the page stays responsive.
Inclusive ranges and equal chances
Enter a minimum, a maximum and how many numbers you want. Both ends are included, so 1 to 100 contains 100 possible whole numbers and each has a 1% chance on every draw, while 1 to 6 behaves like a fair die with 16.67% for each face. The generator uses the browser’s cryptographically secure source and rejection sampling, so values at the top of the range are not slightly more or less likely than the rest, a flaw found in some quick formulas.
Why repeats appear sooner than expected
With duplicates allowed, each number is drawn independently, and repeats become likely surprisingly fast. Drawing 5 numbers from 1 to 100 produces at least one repeated value 9.65% of the time. Drawing 23 numbers from 1 to 365 produces a repeat 50.73% of the time, the classic birthday paradox. If your raffle tickets or test IDs must be different, clear “Allow duplicates” so each value appears at most once in that set.
Unique sets and practical limits
With duplicates turned off, the quantity cannot exceed the number of values in the range. Asking for 10 numbers from 1 to 10 returns all ten values exactly once in random order, which is a quick way to shuffle numbered seats or questions. A single request is limited to 1,000 numbers so the page stays responsive. Only integers are produced; for a random decimal, generate an integer in a larger range and divide it, for example 1 to 1,000 divided by 100.
Worked examples| Input | Result |
|---|
1–100 · ×1 | P(each value) 1% |
1–6 · ×1 | P(each value) 16.67% |
1–100 · ×5 · duplicates allowed | P(any repeat) 9.65% |
1–365 · ×23 · duplicates allowed | P(any repeat) 50.73% |
1–10 · ×10 · no duplicates | all 10 values once |