Probability facts for 0–9
| Question | Answer |
|---|---|
| Chance of one specific number | 1 in 10 (10%) |
| Chance of an even number | 5 of 10 = 50% |
| Chance of a prime number | 4 primes = 40% |
| Average result (expected value) | 4.5 |
| Standard deviation | 2.87 |
| Chance a given number shows up at least once in 10 picks | 65.1% |
| Chance of at least one repeat in 5 picks | 69.8% |
| Picks needed for a 50% chance of a repeat | 5 |
| Average picks to see every number at least once | 29 |
How it works
The generator draws a uniform random integer from 0 to 9 with crypto.getRandomValues and adds 0. Rejection sampling removes the small bias that the plain “random modulo 10” trick would cause (here 232 mod 10 = 6 values would otherwise be favored).
The repeat surprise
Duplicates come sooner than intuition suggests. With 10 possible values, 5 picks already give a better-than-even chance that two match — the same maths as the birthday problem. Tick “No repeats” if you need distinct numbers.
Every outcome
| Number | Probability |
|---|---|
| 0 | 10% (1/10) |
| 1 | 10% (1/10) |
| 2 | 10% (1/10) |
| 3 | 10% (1/10) |
| 4 | 10% (1/10) |
| 5 | 10% (1/10) |
| 6 | 10% (1/10) |
| 7 | 10% (1/10) |
| 8 | 10% (1/10) |
| 9 | 10% (1/10) |