Random Number Generator
Pick a range and draw one or many random numbers, whole or with decimals, with or without repeats. You can also roll 1 to 10 dice or flip a coin. Everything is generated in your browser with its cryptographic generator, and results are not saved.
Works anywhere in the world, wherever you are.
1 to 1000.
0 = whole numbers; up to 6.
Result
—
Press the button to get a result.
Every value in the range is equally likely. Sorting happens after the draw, so it never changes which numbers come up.
Results are generated in your browser with its cryptographic generator (crypto.getRandomValues). They are not saved, not in the Share link and not sent to analytics. Only the options are remembered.
Related tools
Virtual Dice Roller
Everyday
1 to 10 dice, d4 to d20, with the total and your recent rolls.
OpenCoin Flip: Heads or Tails
Everyday
Flip a virtual coin once or up to 1,000 times.
OpenName Picker Wheel
Everyday
Paste a list, spin the wheel and pick a random winner.
OpenSecure Password Generator
Everyday
Random passwords from 8 to 128 characters, in your browser.
OpenAbout this calculator
How to use it
Choose the mode at the top. In “Numbers”, enter where the range starts and ends (both ends count), how many numbers you want and how many decimal places; 0 decimal places means whole numbers. If numbers must not repeat, as when drawing turns, choose “No”. The order can stay as drawn, go low to high or high to low.
In “Roll dice” you choose the type of die (d4, d6, d8, d10, d12 or d20) and 1 to 10 dice; you see each die and the total. In “Heads or tails” you flip the coin once or up to 1,000 times and the tool counts how many heads and tails came up.
Nothing is drawn until you press the button, and if you change an option the previous result is cleared so it is not mistaken for the new one.
How the numbers are generated
Every number comes from crypto.getRandomValues, the browser's cryptographic generator, the same kind used to create encryption keys. JavaScript's ordinary generator, which is not built for this, is never used.
The generator gives 32-bit numbers, and not every range fits into them evenly. Simply taking the remainder of a division would make some results come up very slightly more than others. So the leftover values are thrown away and another one is drawn (rejection sampling): that way every value in the range has exactly the same chance.
Without repeats, Floyd's algorithm picks a set of distinct numbers in which every possible set is equally likely, and then they are shuffled. Sorting the results happens after the draw, so it never changes which numbers come up.
Example
From 1 to 100 there are 100 possible values, so each number has a 1% chance. From 0 to 1 with 2 decimal places there are 101 possible values: 0.00, 0.01 and so on up to 1.00.
With two six-sided dice (2d6) the total runs from 2 to 12 and the expected average is 7. With one d20 it runs from 1 to 20, averaging 10.5.
Why rejection sampling is needed: there are 4,294,967,296 32-bit values and, split among the 6 faces of a die, 4 are left over. Those 4 are thrown away; otherwise the first faces would come up very slightly more than the others.
What people use it for
Choosing who goes first in a game or the order of turns, handing out numbers in a draw among friends or in a classroom, picking a random sample from a numbered list, or practising probability with dice and coins.
Your results stay with you
Numbers, dice and coins are generated in your browser and never sent to a server. They are not saved, not in the Share link and not sent to the site's statistics. The only thing remembered on your device is the options: the range, the count and the mode.
Important limitations
- It is meant for informal draws, games and classrooms. An official raffle, sweepstakes or lottery has its own rules and usually requires a supervised process; this tool does not replace it.
- It draws up to 1,000 numbers at a time with up to 6 decimal places. Without repeats you cannot ask for more numbers than the range has possible values.
- With decimals, the ends are rounded inward to the nearest possible value: from 0.5 to 2 with 0 decimal places, only 1 and 2 can come up.
- Results are not saved: reload the page and they are gone. Copy them if you need them.
Frequently asked questions
This calculation runs in your browser and is never sent to a server. Your last values may be saved on your device only, for convenience. Results are estimates and are not financial, tax, accounting or legal advice.