Random number generator
Whole numbers or decimals between any two values, one at a time or as a list, with or without repeats.
Quick answers
- 1 to 10
- 1 in 10 each
- 1 to 100
- 1 in 100 each
- 1 to 1,000
- 1 in 1,000 each
- 6 different from 1 to 49
- 1 in 13,983,816 sets
- A 4-digit number
- 1 in 9,000 each
- A decimal from 0 to 1
- 1 in 101 at 2 places
Random tools
13 tools in 4 groups; the main tool of each group comes first
Numbers, letters and dates4
Dice, coins and cards3
Names, lists and teams3
Passwords and identifiers3
Popular calculations
Each opens the generator with the range filled in
| Range | Use | Draw | Chance |
|---|---|---|---|
| 1–2 | A yes-or-no choice | One number from 1 to 2 | 1 in 2 |
| 1–6 | Stand-in for a die | One number from 1 to 6 | 1 in 6 |
| 1–10 | Classroom and party games | One number from 1 to 10 | 1 in 10 |
| 1–100 | Percentages and raffles | One number from 1 to 100 | 1 in 100 |
| 1–49 | A 6-number lottery line | 6 different numbers from 1 to 49 | 1 in 13,983,816 |
| 0000–9999 | A four-digit code | One number from 0 to 9,999 | 1 in 10,000 |
How it works
Each number comes from the Web Crypto generator built into your browser. It produces random 32-bit blocks, and the generator turns them into your range by rejection sampling, throwing away the few blocks that would make some numbers more likely than others, so every value in the range has exactly the same chance.
With “No repeats”, the numbers are drawn the way balls leave a lottery machine, each one from the values still left. Without it, each number is drawn from the whole range, and repeats are possible. Nothing you enter or draw leaves your device.
Sources
- W3C Web Cryptography API, getRandomValues()
- Donald E. Knuth, The Art of Computer Programming, vol. 2, section 3.4.2 (random sampling and shuffling)
- NIST SP 800-90A Rev. 1, recommendation for random number generation using deterministic random bit generators