Random Integer List Generator
Generate a list of up to 10,000 random whole numbers between any two integers, with or without repeats. Count in steps, leave out numbers you don't want, sort the list, and check its mean, median, standard deviation and sum before copying it.
Every allowed number equally likely · both bounds included
Dice or Lottery Balls: With or Without Repeats
With repeats allowed, every number is a fresh roll of the same die: earlier results stay in play, so 20 rolls of 1 to 6 always contain repeats. That's the right model for dice, test scores, quantities and simulations.
Tick No repeats and the list behaves like lottery balls taken out of a drum: each number can appear once, so you can't ask for more numbers than the range holds. The page shuffles the allowed numbers and takes the first ones, so every possible set is equally likely. A 6-from-49 draw has 13,983,816 possible sets of numbers.
Repeats arrive sooner than intuition suggests even in big ranges. Ten numbers from 1 to 100 contain at least one repeat 37% of the time; twenty numbers, 87% of the time. If your data must be unique, such as IDs or ticket numbers, tick the box rather than hoping. To pick just one number, the random integer picker is quicker.
Worked Example: A Random Order for 30 Students
A teacher wants a fair order for 30 presentations. The class list is already numbered 1 to 30 alphabetically.
Settings (the "Shuffle 1–30" preset)
Reading the result
Why it's fair
Asking for as many numbers as the range holds, with no repeats, gives a shuffle. The same trick splits a class into groups: shuffle 1 to 30, then take the first five numbers as group A, the next five as group B, and so on. Copy the order before generating again, since nothing is saved.
What a Fair List’s Summary Should Look Like
For whole numbers from a to b with every value equally likely, the expected mean is the midpoint and the spread is fixed by the number of values, N = b − a + 1:
| Range | Expected mean | Standard deviation | Mean of 30 numbers, usually within |
|---|---|---|---|
| 1 to 6 | 3.5 | 1.71 | 2.9 to 4.1 |
| 1 to 10 | 5.5 | 2.87 | 4.5 to 6.5 |
| 0 to 100 | 50 | 29.15 | 39.4 to 60.6 |
| 1 to 100 | 50.5 | 28.87 | 40.0 to 61.0 |
The last column is the mean ± 2 standard errors (standard deviation ÷ √30), which covers about 95% of lists. So 30 numbers from 1 to 100 averaging 58 is perfectly normal; averaging 70 would be unusual. With 1,000 numbers the band shrinks to about 48.7 to 52.3. The Expected mean tile shows the target for a plain range so you can compare at a glance.
Steps and Left-Out Numbers
Step counts up from the minimum, so the minimum decides which numbers you get. Leave out removes single numbers or ranges after that. Both keep every remaining number equally likely.
| You want | Min | Max | Step | Leave out | Numbers available |
|---|---|---|---|---|---|
| Even numbers 2 to 100 | 2 | 100 | 2 | — | 50 |
| Odd numbers 1 to 99 | 1 | 99 | 2 | — | 50 |
| Multiples of 5 from 0 to 100 | 0 | 100 | 5 | — | 21 |
| 1 to 20 without 13 | 1 | 20 | 1 | 13 | 19 |
| Room numbers, skipping the 400s | 100 | 599 | 1 | 400-499 | 400 |
If the maximum isn't on the step, the last number is the one below it: 0 to 98 in steps of 5 ends at 95.
Random Integer Lists in Excel, Sheets and Python
Excel 365: 10 numbers from 1 to 100, repeats allowed
=RANDARRAY(10, 1, 1, 100, TRUE)Excel 365: 6 from 49, no repeats
=TAKE(SORTBY(SEQUENCE(49), RANDARRAY(49)), 6)Google Sheets: 6 from 49, no repeats
=ARRAY_CONSTRAIN(SORT(SEQUENCE(49), RANDARRAY(49), TRUE), 6, 1)Python
import random
random.choices(range(1, 101), k=10) # repeats allowed
random.sample(range(1, 50), 6) # no repeats
random.sample(range(1, 31), 30) # a shuffle of 1 to 30The no-repeat formulas work the same way as this page: give every number a random sort key, sort, and take the top few. Google Sheets' RANDARRAY only makes decimals between 0 and 1, which is why the Sheets version sorts by it rather than using it for the numbers directly. In Python, range(1, 101) stops before 101.
Frequently asked questions
How do I generate random numbers without repeats?
Tick No repeats. The list can then hold at most as many numbers as the range allows, and every possible set is equally likely. Set How many to the size of the range for a full shuffle.
Can the list include negative numbers and zero?
Yes. Enter a negative minimum such as −20. Any whole numbers up to about ±9 quadrillion work, as long as the difference between them stays within that limit.
How do I get only even or only odd numbers?
Set Step to 2. Start from an even minimum for even numbers or an odd minimum for odd numbers.
Why doesn’t my list contain every number in the range?
Each number is drawn independently, so some values come up twice and others not at all. For every number exactly once, ask for the full range with No repeats ticked.
Sources
- NIST/SEMATECH e-Handbook: Uniform Distribution: every value in the range equally likely.
- Python documentation: random module: choices() with replacement and sample() without.
- Microsoft Support: RANDARRAY function: rows, columns, min, max and whole-number output.
- Google Docs Editors Help: RANDARRAY: returns values between 0 and 1.
Related Tools
Create GUIDs for Microsoft and .NET fields.
Generate binary numbers with a chosen bit length.
Create a random pixel image and save it as a PNG.
Generate bytes in hex, Base64, or decimal format.
Pick a date between your chosen start and end dates.
Generate decimals with a chosen range and precision.