Random Number Generator
Set a range and press Generate: the page picks a whole number between the two ends, both included, and every number in the range is exactly as likely (1 in 100 for 1 to 100). It can also draw several numbers at once with or without repeats, sort them, flip coins and roll dice. Each draw uses your browser’s cryptographic random number generator with rejection sampling, so there is no modulo bias, and nothing is sent anywhere.
Updated Runs in your browser: nothing you enter is uploadedHow this tool works
Random numbers
Example result, printed in the page (not random)
42
1 number from 1 to 100. Chance of this exact result: 1 in 100.
Flip a coin
Not flipped yet
Heads or tails, 50/50.
Roll dice
Not rolled yet
Two six-sided dice.
Drawn on your device with your browser’s Web Crypto random number generator, without modulo bias. Nothing you draw is sent or saved.
The chance of one exact result
| Draw | Chance |
|---|---|
| A coin flip | 1 in 2 |
| One six-sided die | 1 in 6 |
| A number from 1 to 10 | 1 in 10 |
| A number from 1 to 100 | 1 in 100 |
| A number from 1 to 1,000 | 1 in 1,000 |
| 3 different numbers from 1 to 10 | 1 in 120 |
| 5 different numbers from 1 to 50 | 1 in 2,118,760 |
| 6 different numbers from 1 to 49 | 1 in 13,983,816 |
Two dice: the chance of each total
| Total | Ways | Chance |
|---|---|---|
| 2 | 1 of 36 | 2.8% |
| 3 | 2 of 36 | 5.6% |
| 4 | 3 of 36 | 8.3% |
| 5 | 4 of 36 | 11.1% |
| 6 | 5 of 36 | 13.9% |
| 7 | 6 of 36 | 16.7% |
| 8 | 5 of 36 | 13.9% |
| 9 | 4 of 36 | 11.1% |
| 10 | 3 of 36 | 8.3% |
| 11 | 2 of 36 | 5.6% |
| 12 | 1 of 36 | 2.8% |
Why plain “% n” is unfair, and how often a draw is redone
| Range size n | Leftover words | Chance a draw is redone | Bias without rejection |
|---|---|---|---|
| 2 | 0 | never | none: 2 divides 2^32 exactly |
| 6 | 4 | 1 in 1,073,741,824 | 4 of the 6 results more likely by 1 part in 715,827,882 |
| 10 | 6 | 1 in 715,827,883 | 6 of the 10 results more likely by 1 part in 429,496,729 |
| 100 | 96 | 1 in 44,739,243 | 96 of the 100 results more likely by 1 part in 42,949,672 |
| 1,000 | 296 | 1 in 14,510,025 | 296 of the 1,000 results more likely by 1 part in 4,294,967 |
| 1,000,000 | 967,296 | 1 in 4,440 | 967,296 of the 1,000,000 results more likely by 1 part in 4,294 |
| 3,000,000,000 | 1,294,967,296 | 30.2% | 1,294,967,296 of the 3,000,000,000 results twice as likely as the rest |
How to pick a random number
- Set the range. Type the lowest and highest numbers you want, for example 1 and 100. Both ends can come up. Negative numbers work too.
- Choose how many. Leave it at 1 for a single number, or ask for several. Turn on “Allow repeats” if the same number may come up twice, like rolling a die again.
- Generate. Press Generate. Each press is a new, independent draw; earlier results have no effect on the next one.
- Share the settings, not the result. Copy link to these settings sends the range and options. Whoever opens it draws their own number: a link cannot prove what someone else drew.
Frequently asked questions
- Is this random number generator really random?
- It uses crypto.getRandomValues, the random number generator browsers provide for encryption keys, seeded by your operating system. That is unpredictable in practice, far stronger than the Math.random function most quick tools use. Each number in your range has exactly the same chance, and one draw tells you nothing about the next.
- What is modulo bias, and why does it matter?
- A computer produces random bits, not random numbers from 1 to 100. The shortcut is to take a big random number and keep the remainder after dividing by the size of the range, but unless the range divides the number of possible values exactly, the smallest results get slightly more chances. This page throws those leftover values away and draws again (rejection sampling), so the bias is exactly zero. The table above shows how rarely that redraw is needed.
- How do I pick several numbers without repeats, like lottery numbers?
- Set the range (1 to 49, say), set How many numbers to 6, leave Allow repeats off and tick Sort smallest first. The numbers are drawn with Floyd’s algorithm, which gives every set of 6 the same chance, 1 in 13,983,816 for 6 from 49. This is for fun and games: it cannot make any lottery ticket more likely to win.
- Why can I share the settings but not the result?
- Because a link cannot prove a draw. A link that said “the number was 17” could be typed by anyone, so it would show nothing about what was really drawn. The fair way to settle something is to agree on the settings, then draw once where everyone can see it, for example on a shared screen. The settings link makes that easy; every page that opens it draws its own fresh number.
- Is every number between the two ends possible?
- Yes. Both ends are included, so a range from 1 to 10 has ten possible results, each with a 1 in 10 chance. Ranges can be as wide as minus to plus one quadrillion (10^15).
- Are the coin flip and dice fair?
- Yes. A coin is a draw from two outcomes and a die a draw from 1 to its number of sides, with the same unbiased method as the numbers. Rolling several dice rolls each one separately, which is why a total of 7 with two dice is far more common than 2 or 12.
- Is anything I draw saved or sent?
- No. The numbers are drawn and shown on your device only. The page keeps no history, and analytics (only if you accepted them) record that a button was pressed, never a number or a setting.
How it works
Every draw starts from crypto.getRandomValues, which fills 32-bit words with random bits from the operating system’s secure generator. To get a whole number from 0 to n − 1, the page takes one word (two for ranges over 2^32, combined into a 53-bit value) and accepts it only if it is below the largest multiple of n that fits; otherwise it draws again. The accepted word modulo n is then exactly uniform, and adding the low end of your range gives the result. Numbers without repeats use Floyd’s sampling algorithm (one draw per number, however large the range) and are then put in random order with a Fisher–Yates shuffle, unless you asked for them sorted. Coins are a draw from two outcomes and dice from 1 to the number of sides. Nothing is precomputed, stored or sent: each press is a fresh draw on your device.
Sources
More free tools
- Random Name PickerPaste a list and pick a random winner, shuffle it or split it into teams. Every entry has the same chance, and your list never leaves your device.
- Random Team GeneratorPaste names, choose how many teams or people per team, and split them randomly and evenly. Reshuffle, copy the teams or share a link to the same split.
- Password GeneratorMake a strong random password or passphrase on your device: choose length and characters, see its strength in bits and copy it. Nothing is sent.
- UUID GeneratorGenerate random v4 and time-ordered v7 UUIDs on your device, up to 1,000 at a time, and inspect any UUID for its version, variant and embedded timestamp.
- Standard Deviation CalculatorPaste numbers and get the standard deviation (sample and population), variance, mean, quartiles and z-scores, with the step-by-step working and a dot plot.
- Percentage CalculatorWork out X% of Y, what percent X is of Y, percentage change, a % increase or decrease, and the original before a discount, with the formula shown.