Skip to content

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)

Minimum 1 · maximum 30 · how many 30 · no repeats · order as drawn

Reading the result

If the list starts 17, 4, 29 … then student 17 goes first, student 4 second, student 29 third

Why it's fair

Every one of the 30! ≈ 2.65 × 10³² possible orders is equally likely

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:

mean = (a + b) ÷ 2  ·  standard deviation = √((N² − 1) ÷ 12)
Expected mean and spread for common integer ranges
RangeExpected meanStandard deviationMean of 30 numbers, usually within
1 to 63.51.712.9 to 4.1
1 to 105.52.874.5 to 6.5
0 to 1005029.1539.4 to 60.6
1 to 10050.528.8740.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.

Example settings using step and exclusions
You wantMinMaxStepLeave outNumbers available
Even numbers 2 to 10021002—50
Odd numbers 1 to 991992—50
Multiples of 5 from 0 to 10001005—21
1 to 20 without 1312011319
Room numbers, skipping the 400s1005991400-499400

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 30

The 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