How to Use a Random Number Generator With No Repeats
To get random numbers with no repeats, set your range (for example 1 to 250), set how many numbers you need, and turn off repeats. The generator then works like drawing from a hat: once a number comes out, it can't come out again. Behind the scenes there are two correct ways to do this. You can re-draw whenever a duplicate shows up, or you can shuffle the whole list once and read numbers off the top. Done properly, both are fair.
When a random number generator with no repeats gives an unfair result, the cause is usually the setup, not the randomness. People type the wrong end of the range, quietly drop a number or two, use a "fix" for duplicates that tilts the odds, or forget to write the results down. This guide covers three common jobs: drawing 3 winners from raffle tickets 1–250, putting 24 students in a random seating order, and calling bingo numbers. Each one comes with the math and the mistakes to watch for.
If you want to know where the randomness itself comes from, see how random number generators work. This article assumes the generator is sound and focuses on using it correctly.
What "no repeats" means in probability terms
Statisticians call a draw with no repeats sampling without replacement. Each number drawn is set aside and can't be picked again. Drawing with replacement means every draw starts from the full range, so the same number can come up twice. That's the right model for dice, but not for a raffle.
Take 3 winners from 250 tickets. The chance that one particular ticket is not picked is:
- First draw: 249/250
- Second draw: 248/249
- Third draw: 247/248
Multiply them and almost everything cancels: (249 × 248 × 247) / (250 × 249 × 248) = 247/250. So the chance that a given ticket wins one of the three prizes is 1 − 247/250 = 3/250 = 0.012, or 1.2%. That's the same for ticket 1, ticket 137, and ticket 250.
Any method that gives every ticket this same chance and makes every possible set of three winners equally likely is fair. Equal odds per ticket alone isn't enough. For example, picking a random ticket plus the next two (wrapping from 250 back to 1) gives each ticket 1.2%, but it only ever produces consecutive winners. There are 250 × 249 × 248 ÷ 6 = 2,573,000 possible sets of three tickets. A fair draw makes each one equally likely, while the "plus the next two" method can only produce 250 of them.
Re-drawing duplicates vs. shuffling first
Method 1: Draw, and re-draw on duplicates
Pick a number from the full range. If you've already drawn it, throw the result away and draw again from the full range. Keep going until you have enough unique numbers.
This is fair because each new draw is uniform over the whole range. When you reject duplicates, the accepted number is equally likely to be any of the numbers not yet drawn. The cost is wasted draws, and that cost grows as you use up the range. On average, drawing k unique numbers from n takes n/n + n/(n−1) + … + n/(n−k+1) draws.
- Raffle, 3 from 250: 1 + 250/249 + 250/248 ≈ 1 + 1.004 + 1.008 = about 3.01 draws. Duplicates almost never happen.
- Bingo, all 75 numbers: 75 × (1 + 1/2 + … + 1/75) ≈ 75 × 4.901 = about 368 draws to get 75 unique numbers. Still fair, but very wasteful, and the last few numbers take a long time to show up.
Method 2: Shuffle the whole list (Fisher–Yates)
Write out every possible number, shuffle the list once, and take as many as you need from the front. The standard correct shuffle is the Fisher–Yates shuffle (also called the Knuth shuffle). For a list with positions 1 to n:
- Start with the last position, n.
- Pick a random position j from 1 up to the current position, including the current position itself.
- Swap the items at the current position and position j.
- Move one position toward the front and repeat steps 2–3 for each position down to and including position 2. Position 1 needs no step, because by then only one item is left to place.
When it finishes, the list is in random order. To draw 3 raffle winners, shuffle 1–250 and read the first three numbers.
Why both methods are fair
With Fisher–Yates on 3 items, the step at position 3 has 3 choices and the step at position 2 has 2. That's 3 × 2 = 6 equally likely paths, and each one produces exactly one of the 6 possible orderings. No ordering gets more paths than another, so none is favored. Re-drawing reaches the same result by a different route: each accepted number is uniform over whatever is left.
| Re-draw on duplicates | Shuffle first (Fisher–Yates) | |
|---|---|---|
| Fair when done correctly | Yes | Yes |
| Best for | A few picks from a big range | Using most or all of the range |
| Wasted draws | Rare for small picks, many near the end | None |
| Needs the full list in memory | No | Yes |
| Typical use | Raffle winners, spot checks | Seating orders, bingo calling order |
How to set up a random number generator with no repeats
The free Random Number Generator picks numbers in any range, with or without repeats. In it, or in any similar tool, the setup comes down to four choices: the lowest value, the highest value, how many numbers you want, and the option that turns repeats off. Labels and limits differ between tools, so before a draw that matters, check two things. Make sure the setting you chose really means "no duplicates," and make sure the highest value can actually come up (there's a quick test further down).
One more point applies to most generators: "no repeats" covers a single batch. Each new click is usually an independent draw that can return numbers you got earlier. If you need unique numbers across the whole job, get them all in one batch, unless your tool clearly says it remembers earlier results.
Example 1: Three raffle winners from tickets 1–250
- Confirm the ticket range. If you sold tickets 1 through 250, the minimum is 1 and the maximum is 250.
- Ask for 3 numbers with repeats off.
- Decide before you draw what the order means. A common rule is first number = grand prize, second = second prize, third = third prize.
- Decide before you draw what happens if a winner can't be reached. Usually you draw one more number. If that new draw matches a ticket that already won, draw again.
- Generate once, announce the numbers, and record them (see the recording section below).
Raffles and prize draws are regulated in many places, and the rules differ by country, state, and province. Check the official rules where you live before you run a public or paid draw.
Example 2: A random seating order for 24 students
- Number the class list from 1 to 24, for example in alphabetical order. Save this numbered list, because the draw means nothing without it.
- Ask for 24 numbers from 1 to 24 with no repeats. You get every number once, in random order. In other words, it's a full shuffle.
- Read the result as "the i-th number is the student in seat i." If the output starts 17, 4, 22…, student #17 takes seat 1, student #4 takes seat 2, and so on.
There are 24! (24 factorial) possible orders, which is 620,448,401,733,239,439,360,000, or about 6.2 × 10²³. A fair shuffle makes every one of them equally likely. If you need groups instead of a single order, take the shuffled list in chunks of 4 or 6. You can also use the Random Team Generator, which shuffles a list of names into evenly sized teams.
Example 3: Calling bingo numbers
US-style bingo uses 75 balls: B is 1–15, I is 16–30, N is 31–45, G is 46–60, and O is 61–75. UK-style bingo uses 90 balls with no letters.
- Set the range to 1–75 (or 1–90 for UK-style bingo), turn repeats off, and ask for all 75 (or 90) numbers in one batch.
- Call the numbers in the order they appear.
- To add the letter, divide the number by 15 and round up. A result of 1 = B, 2 = I, 3 = N, 4 = G, 5 = O. For example, 47 ÷ 15 ≈ 3.13, which rounds up to 4, so 47 is G.
- Mark each number as you call it so you can check a winning card against the called list.
Don't click once for each call. Separate clicks are separate draws, so a number you called ten minutes ago can come up again. Generating the whole calling order up front is the shuffle method. It also means a reloaded browser tab can't make you lose track of what's been called, as long as you saved the list.
Inclusive vs. exclusive range ends
A range is inclusive if both end numbers can come up, and exclusive at one end if that number can't. In everyday speech, "1 to 250" means 1 and 250 are both possible. Many programming functions disagree, and that's how ticket 250 quietly ends up with zero chance.
| Function | Range it actually produces |
|---|---|
JavaScript Math.random() |
0 up to but not including 1 |
Math.floor(Math.random() * 250) + 1 |
Integers 1 to 250, inclusive |
Python random.randint(1, 250) |
1 to 250, both ends included |
Python random.randrange(1, 250) |
1 to 249 (250 excluded) |
Excel RANDBETWEEN(1, 250) |
1 to 250, both ends included |
The MDN documentation for Math.random() says the upper end is excluded and that the function isn't meant for security-sensitive uses. For anything with real stakes, the browser's crypto.getRandomValues() is the stronger source. For a classroom draw, either is fine.
A quick test for any tool
Ask for 3 numbers from 1–3 with repeats off. A tool that includes both ends has to return 1, 2, and 3 in some order. If it gives an error, returns fewer numbers, or can't produce one of the end values, that end is being excluded.
If your tool only does single draws, run at least 20 of them. Even when 3 is possible, it can stay hidden by chance: the probability of missing it in 5 fair draws is (2/3)^5 = 32/243 ≈ 13%. In 20 draws it falls to (2/3)^20 ≈ 0.03%.
Mistakes that quietly make a draw unfair
"Bumping" a duplicate to the next number
If 47 is already taken and a fix moves the duplicate to 48, then 48 now wins whenever 47 or 48 comes up. That doubles its chance. Always re-draw from the full range, or remove the used number from the list. Never shift to a neighbor.
A shuffle that picks from the whole list every time
A common bug in homemade shuffles is picking the swap position from the entire list at every step instead of from the unshuffled part. With 3 items, that gives 3 × 3 × 3 = 27 equally likely paths spread over only 6 orderings. Since 27 doesn't divide evenly by 6, some orderings come up 5 times out of 27 and others only 4. Sorting a list with a random comparison has similar bias problems. Stick to Fisher–Yates or a library function built for the job, such as Python's random.sample or random.shuffle.
Squeezing a range with remainders (modulo bias)
Code that takes a random byte (0–255) and uses the remainder after dividing by 250 isn't uniform. That's 256 possible values spread over 250 results, so results 0–5 each get two chances in 256 while the rest get one. Good libraries handle this for you. Homemade one-liners often don't.
Quietly skipping numbers
If tickets 1–250 were printed but 12 were never sold, decide in advance what happens: either exclude those numbers from the list, or re-draw if one comes up. If you silently drop a ticket, or shrink the range to 1–238 because "most tickets are below that," you've changed who can win. Write the list of eligible numbers down before the draw.
Re-running until the result "looks right"
Results like 3, 4, 5 or 101, 102 look suspicious but are just as likely as any other set. If you generate again because you don't like the first result, the draw is no longer random. You've picked the winners yourself. The same intuition trap is behind the gambler's fallacy, covered in coin flip probability.
Record the draw so anyone can check it
A fair draw that nobody can verify still invites arguments. Write down:
- The eligible numbers, written as a range plus any exclusions (for example "1–250, excluding 88 and 191")
- What the numbers stand for (ticket numbers, the numbered class roster, bingo balls)
- The tool used, the settings (lowest value, highest value, how many, repeats off), and the date and time
- Every result in the order it came out, including any re-draws and the reason for each
- Who was there, if it's a public draw
A screenshot of the generator's output plus a short text note is usually enough. For high-stakes draws, run the generator on a shared screen or in front of witnesses so no one has to take the result on trust.
Quick reference: a fair no-repeat draw
- Range: Both ends included? Test by asking for 3 numbers from 1–3 with repeats off.
- Eligible list: Gaps and exclusions written down before you draw.
- Repeats: Turned off, and the setting checked.
- One batch: Get all the numbers you need in a single generation. Separate clicks can repeat.
- Method: Re-draw for a few picks from a big range. Shuffle when you need most or all of the list.
- Duplicates: Re-draw from the full range or remove the used number. Never bump to a neighbor.
- Rules first: Prize order and the no-show rule decided before generating.
- One run: Generate once and accept the result.
- Record: Settings, time, every result in order, and any re-draws with reasons.
Frequently Asked Questions
Can I get random numbers without duplicates in Excel?
RANDBETWEEN can return the same number twice, so it isn't enough by itself. A dependable approach is to list your numbers in one column, put =RAND() in the next column, and sort both columns by the RAND column. RAND recalculates whenever the sheet changes, so copy the results and paste them as values before you rely on them.
Is it still random if the winning numbers are consecutive, like 14, 15, 16?
Yes. With 3 winners from 250 tickets, the set 14, 15, 16 is exactly as likely as any other set of three. It only looks unusual because people notice patterns. Throwing out a result because it looks too neat makes the draw less fair.
How do I pick random numbers but exclude certain numbers?
You have two fair options. You can build a list of only the eligible numbers and shuffle it, or you can draw from the full range and re-draw whenever an excluded number comes up. Both give every eligible number the same chance, as long as the exclusions are decided and written down before the draw.
Does it matter whether I draw all winners at once or one at a time?
For fairness, no, as long as no ticket can win twice. If you ask for all three numbers in one batch with repeats off, the tool handles that for you. If you click once per winner, each click is usually an independent draw, so re-draw any number that has already won. Either way, decide before the draw what the order means, for example that the first number gets the top prize.
What happens if I ask for more unique numbers than the range contains?
It can't be done. A range of 1 to 24 holds only 24 distinct numbers, so you can't get 25 without repeats. Depending on the tool, you'll get an error or fewer numbers than you asked for, so if the count looks wrong, check the range first.