Random Number Generator
Pick random whole numbers or decimals between a minimum and maximum, with no repeats if you want, sorting, and presets for dice, coin flips, and lottery picks.
Your data stays in your browser. This tool processes your input locally and does not upload it to a server.
What is an unbiased random number generator?
A random number generator picks numbers from a range you choose so that every value is equally likely. This one draws from the browser’s cryptographically secure random source and uses rejection sampling, so there is no modulo bias. You can set decimals, draw without repeats, sort the results, and use presets for dice, coin flips and lottery picks.
Why rejection sampling matters
The browser’s crypto.getRandomValues returns random 32-bit numbers. A common shortcut is to take that number modulo the size of your range, but that makes some results slightly more likely when the range does not divide 2 to the power of 32 evenly. For a six-sided die, 2^32 leaves a remainder of 4 when divided by 6, so the values 1 to 4 would each come up a tiny bit more often than 5 and 6.
This tool avoids the problem. It keeps only as many random bits as the range needs, and if the result falls outside the range it throws that draw away and tries again. Every accepted value is then equally likely. Ranges up to 2 to the power of 53 are supported, which covers all safe integers.
Options and limits
Minimum and maximum are both inclusive. You can ask for 1 to 10,000 numbers and up to 10 decimal places. Decimals work by scaling the range to whole numbers, drawing one, and dividing back, so 0 to 1 with 2 decimals has 101 possible values, from 0.00 to 1.00, each equally likely.
With No repeats on, the tool draws unique numbers. For ranges up to one million values it performs a partial Fisher-Yates shuffle, and for larger ranges it redraws duplicates. If you ask for more unique numbers than the range holds, it reports an error. You can sort ascending or descending, choose a comma, space or new-line separator, copy the list or download it as random-numbers.txt. A single result is shown in large type.
Examples
Roll a die
Input
Preset Dice (d6): min 1, max 6, count 1Output
One whole number from 1 to 6, each equally likelyLottery-style pick
Input
Preset Lottery (6 of 49): min 1, max 49, count 6, no repeats, ascendingOutput
Six different numbers in order, for example 4, 11, 19, 27, 33, 46The numbers shown are an example. Each run produces a different set.
Decimals
Input
min 0, max 1, count 3, decimal places 2Output
Three values such as 0.37, 0.92, 0.08Any of the 101 values from 0.00 to 1.00 can appear, and repeats are allowed unless No repeats is on.
Common mistakes and edge cases
- Setting a minimum above the maximum. The tool reports an error instead of swapping the values.
- Asking for more unique numbers than exist. Five unique whole numbers cannot come from 1 to 4, and the tool says so.
- Using a random list as a password. The values are secure, but short numeric strings are easy to guess. Use a password generator and a long length for secrets.
- Treating the presets as an official lottery. The Lottery preset only draws numbers and has no link to any real draw.
- Expecting to reproduce a result. There is no seed, so the same settings give different numbers each time. Copy the output if you need to keep it.
- Forgetting that decimals add values. With 0 to 1 and 2 decimals the range has 101 values, not 100, because both ends are included.
How to use this tool
- Set the minimum, maximum, how many numbers, and decimal places.
- Tick No repeats if every number must be different, or choose a preset.
- Generate, then copy the list or download it as a text file.
Frequently asked questions
Is this truly random?
The numbers come from crypto.getRandomValues, the browser’s cryptographically secure generator, which is seeded by the operating system. The tool then maps those bits onto your range with rejection sampling so each value is equally likely. It is suitable for games, raffles among friends, sampling and testing. It has not been audited or certified for regulated draws, so do not use it where a legal standard for randomness applies.
What is modulo bias?
Modulo bias appears when a random number from a larger range is reduced with the remainder operator to fit a smaller range that does not divide it evenly. Some results then occur slightly more often. The effect is tiny for small ranges but grows as the range approaches the size of the source. Rejection sampling removes it by discarding draws that fall outside the range.
How does No repeats work?
It draws different numbers each time, like pulling balls from a bag. For ranges up to a million values the tool runs a partial Fisher-Yates shuffle, which is unbiased. For larger ranges it draws and discards duplicates until it has enough. The count cannot exceed the number of values in the range, and the tool shows how many exist when you ask for too many.
Is there a limit on how many numbers I can generate?
You can generate up to 10,000 numbers in one run, with up to 10 decimal places. The range can be very large: whole-number ranges up to about 9 quadrillion are supported, and a range too large for the chosen decimal places is rejected with a message. Everything runs in your browser.
Are my results saved or sent anywhere?
No. The numbers are generated on your device, shown on the page, and discarded when you leave or reload. Nothing is uploaded, and there is no history. If you want to keep a result, for example to record who won a raffle, copy it or use Download to save a text file before you leave the page. The tool does not log your settings either, so each visit starts from the defaults.
References
Last reviewed