Where the randomness comes from
This generator uses your browser's cryptographic random number generator rather than the ordinary pseudo-random function most code relies on. The difference matters for anything with a real outcome attached.
A standard pseudo-random generator produces a sequence determined by an internal starting value. Given enough output, that state can be inferred and future values predicted. A cryptographic generator is designed specifically so that no amount of observed output reveals anything about what comes next.
Avoiding modulo bias
There is a subtle flaw in the obvious way of turning a random number into a range, and most simple implementations contain it. Taking a random value and applying the remainder operator produces a slightly uneven distribution, because the total range of possible values rarely divides evenly by your target range. The leftover portion makes low numbers marginally more likely.
The bias is small — usually far too small to notice in casual use — but it is real, and it compounds across many draws. This tool uses rejection sampling, discarding values that fall in the uneven remainder and drawing again. The result is a genuinely uniform distribution where every number in your range is exactly equally likely.
Unique numbers
The no-duplicates option changes the operation from repeated independent draws to a random selection without replacement. It works by shuffling the full range with the Fisher-Yates algorithm and taking the first n values.
This distinction matters. Drawing six numbers from one to forty-nine with duplicates allowed is not the same as drawing a lottery combination, where each number can appear only once. Choose unique mode whenever you are picking distinct items — raffle winners, lottery-style selections, or assigning items without repetition.
Common uses
Picking a winner from a numbered entry list. Selecting a random sample from a dataset for quality checking or auditing. Generating test data. Assigning participants to groups in a study. Deciding turn order fairly. Choosing a random item when you have numbered your options.
A note on fairness in public draws
For a giveaway or competition where participants need to trust the outcome, generating a number privately and announcing it afterwards is not verifiable — the audience has only your word for it. If verifiability matters, run the draw on screen where people can watch, record it, or use a method where the seed is published in advance.
Generated on your device
Numbers are produced entirely in your browser and nothing is transmitted, logged or stored. The generator works offline once the page has loaded.
Frequently Asked Questions
Are these numbers truly random?
They use the Web Crypto API's cryptographically secure generator, the same class of randomness used for encryption keys, rather than a predictable pseudo-random function.
What is modulo bias?
A subtle unevenness that appears when a random value is squeezed into a range using the remainder operator. This tool avoids it with rejection sampling, so every number is exactly equally likely.
What does the no-duplicates option do?
It selects without replacement, so each number appears at most once. Use it for raffles, lottery-style draws, and anything picking distinct items.
Can I generate a large batch?
Yes, up to 10,000 at a time. In unique mode the count is capped at the size of your range.
Does it work offline?
Yes. Once the page has loaded, generation continues to work with no connection.