Menu

Random number generator

Whole numbers or decimals between any two values, one at a time or as a list, with or without repeats.

Common ranges:

90

90, drawn from the 100 whole numbers from 1 to 100. Each had the same 1 in 100 chance.

About this result
Possible values100
Chance of this number1 in 100
Chance of the same number next time1 in 100

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

Popular calculations

Each opens the generator with the range filled in

RangeUseDrawChance
1–2A yes-or-no choiceOne number from 1 to 21 in 2
1–6Stand-in for a dieOne number from 1 to 61 in 6
1–10Classroom and party gamesOne number from 1 to 101 in 10
1–100Percentages and rafflesOne number from 1 to 1001 in 100
1–49A 6-number lottery line6 different numbers from 1 to 491 in 13,983,816
0000–9999A four-digit codeOne number from 0 to 9,9991 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

The full method, with a worked example