Worked example
A teacher wants to pick 5 different students from a class register numbered 1 to 30. Set From 1, To 30, How many 5, tick No repeats and choose “Smallest first”. A draw might give 3, 11, 17, 24, 29. Any particular set of 5 has a chance of 1 in 142,506, and every student has the same 5 in 30 (1 in 6) chance of being picked.
How fair numbers are made
The browser hands us raw random 32-bit numbers, from 0 to 4,294,967,295. To get a number from 1 to 6 you can’t simply take the remainder after dividing by 6, because 4,294,967,296 isn’t a multiple of 6: four of the six results would come up very slightly more often. Instead we find the largest multiple of 6 below 2³², throw away any raw value at or above it (a tiny fraction of draws) and use the remainder of the rest. For “no repeats” we shuffle the range with the Fisher–Yates method or draw again on a repeat, so every possible set is equally likely.
Odds of some common draws
| Draw | Chance of one exact result |
|---|---|
| Roll a 6 on a die | 1 in 6 |
| Pick 7 from 1 to 10 | 1 in 10 |
| Guess a 4-digit PIN | 1 in 10,000 |
| 6 from 49 | 1 in 13,983,816 |
| 6 from 59 | 1 in 45,057,474 |
| 5 from 69 (Powerball white balls) | 1 in 11,238,513 |
Every set of numbers is as likely as any other: 1, 2, 3, 4, 5, 6 has exactly the same chance as a “random-looking” set. Past draws don’t change future ones; a number isn’t “due” because it hasn’t come up for a while.
Ideas for using it
- Classrooms: pick who answers next, form random groups by shuffling the class list, or make random sums for practice.
- Games: dice of any size (1 to 20 for tabletop games), random turns, bingo calls with no repeats.
- Research and quality checks: choose a random sample of records, such as 50 invoice numbers out of 2,000.
- Decisions: when two options are equally good, let chance decide and move on.
Random numbers and statistics
Each draw is independent, so short runs often look less random than people expect: in 20 rolls of a die it is normal to see the same number three times in a row, and some numbers may not come up at all. Over many draws the counts even out. If you need a random sample for a survey or audit, generate the record numbers without repeats and sort them so they are easy to find; record the range and the date in your notes so the method can be described. For anything where the outcome must be verifiable by others, such as a public prize draw, use an independent witness as well as a screen recording.
Related tools
- Fraction calculator
- Scientific calculator
- Roman numeral converter
- Area calculator
- Volume calculator
- Percentage calculator
- Weighted average calculator
Sources
Checked on November 26, 2026:
- W3C Web Cryptography API: getRandomValues
- NIST SP 800-90A Rev. 1: Random number generation using deterministic random bit generators (the rejection method in Appendix A.5)
- Knuth, D. E., The Art of Computer Programming, Vol. 2, §3.4.2 (Fisher–Yates shuffle)
Frequently asked questions
Is this random number generator truly random?
Is every number equally likely?
How do I pick numbers without repeats?
Can I pick a name from a list?
Can I use it for a raffle or giveaway?
Are my numbers or lists stored?
Last updated: 2026-11-26