How the numbers are generated
This generator uses your browser's cryptographically secure random number generator, crypto.getRandomValues, rather than the ordinary Math.random. The secure generator is seeded from the operating system's entropy sources and is designed so that its output cannot be predicted.
Turning raw random bits into a number in your range needs care. The naive method — take a random 32-bit integer and use the remainder after dividing by the size of the range — is slightly biased whenever 232 is not an exact multiple of the range size: the smallest values come up a little more often. To avoid that, the generator uses rejection sampling:
n = max − min + 1, limit = 232 − (232 mod n)
draw x; if x ≥ limit, draw again; otherwise result = min + (x mod n)
Every value in the range is then exactly equally likely. For very wide ranges, 53 random bits are combined in the same way. Decimals are drawn from an even grid — with 2 decimal places between 0 and 1 there are 101 equally likely values, 0.00 to 1.00 — so both end points are included.
Duplicates, sorting and a worked example
With the default settings the generator draws 5 integers from 1 to 100, duplicates allowed. There are 100 possible values, so each draw has a 1-in-100 chance of hitting any particular number, and each draw is independent of the others. Because of that independence, repeats happen more often than people expect: the chance that 5 draws contain at least one repeat is 1 − (100 × 99 × 98 × 97 × 96) ÷ 1005 ≈ 9.7%. This is the same effect as the famous birthday problem.
Tick No duplicates to draw without replacement, like pulling numbered balls from a bag. The generator then uses a Fisher–Yates shuffle, so every possible set and every order is equally likely. You cannot ask for more unique numbers than the range contains — 1 to 49 holds at most 49.
Sorting only changes how the results are shown; it does not change which numbers were drawn. Leave it on Random order when the order matters, for example when assigning a running order.
Good uses and limits
Typical uses include picking a raffle or giveaway winner, choosing a random sample of rows for an audit, assigning people to groups, rolling dice (1 to 6) or choosing a random page or question.
Keep in mind:
- Results are not stored or sent anywhere. Each press of Generate produces a fresh draw in your browser, and earlier draws in this session are listed for reference only.
- For official lotteries and regulated draws, use the procedure required by the rules; an online generator is not an audited drawing machine.
- Fairness depends on the setup. A perfectly random draw from the wrong list (for instance, one that includes a name twice) is still unfair.
- Random does not mean evenly spread. Short runs often look clumpy — several numbers close together or a repeat. That is normal and not a sign of a faulty generator.
To work out the chance of an outcome rather than simulate it, try the probability calculator or the permutation and combination calculator.
Frequently asked questions
Is this random number generator truly random?
It uses the browser's cryptographically secure generator, which is unpredictable for all practical purposes, and unbiased rejection sampling so every value in the range is equally likely.
Are the minimum and maximum included?
Yes. Both ends are included, so 1 to 6 can return 1, 2, 3, 4, 5 or 6.
How do I pick lottery-style numbers?
Set the range (for example 1 to 49), set how many numbers you need, tick “No duplicates” and choose “Sort ascending”.
Why did I get the same number twice?
With duplicates allowed, every draw is independent, so repeats are normal. Tick “No duplicates” if each number may appear only once.
Sources & references
Last reviewed: