Random Number Generator
Customize range and quantity, generate random integers instantly
Random Number Generator
Random Number Generator Guide
This tool draws integers from a range you set: a minimum, a maximum, and how many values you want, with optional unique and sorted results. Two ideas explain every surprise users run into — how many values the range actually contains, and how quickly repeats appear once you draw more than a handful. Both are easy to compute in advance, and both are shown below.
Inclusive Range and Value Count
The range is inclusive, so the number of possible values is max − min + 1, not max − min. That off-by-one matters most on small ranges.
| Range | Possible values | Typical use |
|---|---|---|
| 1 to 6 | 6 | Die roll |
| 1 to 10 | 10 | Quick pick |
| 0 to 9 | 10 | Digit drawing |
| 1 to 52 | 52 | Card deck |
| 1 to 100 (default) | 100 | Percentage-style draw |
| −50 to 50 | 101 | Signed offsets, note the odd count |
| 1 to 1000 | 1000 | Lottery-style numbering |
| 1 to 10000 | 10000 | Large pool sampling |
Collision Probability: the Birthday Rule
Drawing with replacement means a value can appear twice. The chance of at least one repeat climbs far faster than intuition suggests: with 100 possible values, 10 draws already collide more than a third of the time.
| Draws | Range of 10 | Range of 100 | Range of 365 | Range of 1000 |
|---|---|---|---|---|
| 5 | 69.8% | 9.7% | 2.7% | 1.0% |
| 10 | 100.0% | 37.2% | 11.7% | 4.4% |
| 15 | 100.0% | 66.9% | 25.3% | 10.0% |
| 20 | 100.0% | 87.0% | 41.1% | 17.4% |
| 23 | 100.0% | 93.6% | 50.7% | 22.5% |
| 30 | 100.0% | 99.2% | 70.6% | 35.6% |
| 50 | 100.0% | 100.0% | 97.0% | 71.2% |
Note: with only 10 possible values, 10 draws are guaranteed to repeat. That is why small ranges need the unique option whenever repeats would spoil the draw.
Unique Mode: Sampling Without Replacement
Ticking unique removes each drawn value from the pool, so repeats become impossible. The cost is a hard ceiling: you cannot draw more unique values than the range contains.
| Range | Maximum unique draws | What happens beyond the limit |
|---|---|---|
| 1 to 6 | 6 | Request is impossible; reduce the count |
| 1 to 10 | 10 | Request is impossible; reduce the count |
| 1 to 52 | 52 | Request is impossible; reduce the count |
| 1 to 100 (default) | 100 | Request is impossible; reduce the count |
| 1 to 1000 | 1000 | Request is impossible; reduce the count |
Choosing a Range That Fits the Job
Picking a range is mostly a question of how many distinct outcomes you need. Classroom draws work well at 1 to 30, where every value stays readable on one screen; raffles usually want 1 to 1000, which leaves room without becoming unwieldy. When you are simulating a physical object, match it exactly — 6 for a die, 52 for a deck — so the behaviour matches what people expect from the real thing. If the result feeds a later step, choose a range whose size divides evenly by the number of groups you need, so no leftover values have to be discarded. And remember that unique mode changes the model: it removes each drawn value from the pool, which is the right choice for assigning distinct items and the wrong one for modelling independent events.
Worked Examples
All three use the tool defaults — minimum 1, maximum 100, one value — so you can reproduce them without changing a setting.
- Single draw: one value from 1 to 100 gives each number a 1.00% chance. Nothing else is assumed about the distribution.
- Ten draws with replacement: the chance that at least one value appears twice is 37.18%. If you need ten distinct numbers, tick unique rather than drawing again and hoping.
- Exhausting a range: with unique ticked, drawing 100 values from 1 to 100 returns every number exactly once — a permutation, not a set of independent draws.
Practical Notes
- Sorting only changes display order; it does not affect which values were drawn.
- Results are not reproducible: there is no seed field, so the same settings give different values each run.
- Browsers expose different randomness sources. General-purpose drawing uses a fast pseudo-random generator, while security-sensitive values should come from the cryptographic source exposed by the platform — for secrets, use the dedicated generator instead.
- Negative bounds are allowed, so −50 to 50 is a valid 101-value range.
Frequently Asked Questions
Why is the range inclusive? Most drawing tasks expect both endpoints to be possible, so 1 to 100 contains 100 values. If you need 99, set the maximum to 99.
Why do I see repeats so often? Collision probability grows quickly with the number of draws: ten draws from 100 values already repeat 37.18% of the time. Use unique mode when duplicates are unacceptable.
What is the largest count I can request in unique mode? The number of values in the range. Asking for more than that is impossible rather than merely slow.
Does sorting make the draw fairer? No. Sorting reorders the same values for readability; the fairness of the draw is unaffected.
Can I use this for passwords or tokens? This tool is built for drawing and sampling. For secrets, use the generator that draws from the platform cryptographic source.
Related Reading
For the mathematics behind repeats and sampling, see our randomness guide. When the goal is a secret rather than a number, use the Password Generator; to publish a drawn result, the QR Code Generator turns it into a scannable code.