Draws are taken from your browser's cryptographic random source, not Math.random, so every outcome is equally likely.
1
Why the obvious way to pick a random number is slightly wrong
Taking a big random value and reducing it with a remainder is the standard trick, and it is biased. Unless the range divides evenly into the source, some numbers get one extra chance. This tool rejects and redraws those cases, so every number in your range really is equally likely.
How it works
- Draws numbers in any range you set, one at a time or up to fifty at once.
- Optionally draws without repeats, which is what you want for a raffle or a lottery line.
- Uses crypto.getRandomValues() rather than Math.random(), with rejection sampling to remove modulo bias.
naive: value % range → biased
correct: limit = floor(MAX / range) × range
redraw while value >= limit
result = min + (value % range)
without repeats: shuffle the whole range, then take the first nWorked example
Drawing a number from 1 to 3 from a source that returns 0, 1, 2 or 3.
- naive: 0→1, 1→2, 2→3, 3→1, so 1 appears twice and gets 50% instead of 33%
- correct: limit = floor(4 / 3) × 3 = 3, so a draw of 3 is rejected and redrawn
- remaining outcomes 0, 1, 2 map to 1, 2, 3 with probability 1/3 each
The bias is tiny for small ranges against a 32-bit source, but it is real, and removing it costs one extra draw very occasionally.
Reading the result
- Drawing without repeats shuffles the whole range and takes the first n, which stays uniform. Repeatedly redrawing and discarding duplicates degrades badly once most of the range is used up.
- The range is inclusive at both ends: 1 to 100 can return 1 and can return 100.
- Nothing is transmitted. The draw happens in your browser, so no server sees the numbers or could influence them.
Common questions
- Can I use this for a prize draw?
- For an informal one, yes — it is unbiased and nothing leaves your machine. For anything with legal or financial weight, use a process that produces an auditable record, since a browser draw leaves no evidence of what happened.
- Is a lottery line drawn here more likely to win?
- No. Every combination has the same chance, whichever way you pick it. Picking randomly does mean you are less likely to share a jackpot, because people cluster on birthdays and patterns.