Random numbers in a range: batches, repeats, sorting
Random whole numbers in batches, with no repeats, sorting and stats.
How the generator works
Set the bounds — for example, from 1 to 100 — and the number of values. The range is inclusive: both the minimum and the maximum can come up. For a draw, enable "no repeats": every number then appears once, as on a lottery ticket. Sorting does not affect randomness, it only orders the finished set.
The sum and the mean are shown below the result — a convenient way to check that the batch looks uniform. For five numbers from 1 to 100 the mean is usually close to 50, but spread in a short run is a normal thing.
Where it comes in handy
Lotteries and draws, picking a speaker, test data for tables, a "roll of two numbers from 1 to 6" instead of a die. If you need access keys or passwords, use a dedicated password generator instead: it has a different character set and entropy estimate.
Why not Math.random
Math.random() produces a pseudorandom sequence: given a few values, the sequence can be reconstructed and the next one predicted. For an everyday task that is a minor detail, for a prize draw it is not. That is why the generator takes bytes from crypto.getRandomValues, and rejection of values removes the bias toward the start of the range.
"No repeats" is limited by the size of the range: you cannot pick twelve unique numbers out of ten — the generator will say so plainly.
Frequently asked questions
How are the random numbers produced?
Each value is drawn uniformly from the range through crypto.getRandomValues. Rejection sampling removes bias, so every number is equally likely.
What does "no repeats" mean?
Each number appears once in the batch. The count then cannot exceed the size of the range, otherwise unique values are impossible.
Is it suitable for a lottery?
Yes, if you switch on "no repeats": you get a set such as six different numbers from 45. Sorting puts them in ascending order without changing the randomness.
How is this different from Math.random?
Math.random() produces a predictable sequence that can be reconstructed from a few values. The browser’s cryptographic generator offers no such opening.
Related tools
Checked: 26 October 2026. For reference only — the result depends on the material and the skill of the installer.