How to Draw Numbers Without Repeats, Simply
Published on
If you draw a number from 1 to 10 three times in a row, you may well get 7 twice. That is not a bug: each draw is independent, and a repeat is possible. When you need different numbers, the approach is different.
The no-repeat mode draws all the numbers at once, treating the range as a list. In practice, the algorithm partially shuffles the range: it picks the first number among all, the second among the remaining ones, and so on. No number comes back.
There is a logical limit. If the range runs from 1 to 20, you cannot draw 30 different numbers. The quantity requested must be less than or equal to the size of the range.
When to use each mode? With repeats, when each draw stands alone, like rolling a die several times. Without repeats, when each number stands for something unique, such as presentation order, a place in a queue or table numbers.
A common mistake is drawing one number at a time and discarding repeats by hand. It works, but it is slow and leaves no record. Drawing everything at once produces a single result link that can be checked.
Set the range and the quantity, and let the generator handle the rest.