Random Number Generator
Generate random whole or decimal numbers within a custom range, with or without repetition, using the browser's Web Crypto API for truly unpredictable results.
How it works
- Set the minimum and maximum values of the range, and how many numbers you want to generate.
- Turn on "Allow duplicates" if the same number can appear more than once, or turn it off for sampling without repetition.
- Choose whether you want whole numbers only or decimal values as well.
- Click "Generate numbers" to get the result, computed with crypto.getRandomValues.
- Copy the list of results with one click.
Use cases
- Run drawings, raffles, or lotteries by picking winners impartially.
- Generate random data samples for statistical or software testing.
- Pick numbers for board games, group activities, or random decisions.
- Create test datasets with numeric values within a specific range.
Use cases
- Run drawings, raffles, or lotteries by picking winners impartially.
- Generate random data samples for statistical or software testing.
- Pick numbers for board games, group activities, or random decisions.
- Create test datasets with numeric values within a specific range.
Common mistakes
- Requesting more non-repeating numbers than fit within the chosen range.If the range doesn't have enough distinct values, the tool detects it and shows an error telling you to reduce the amount, widen the range, or allow duplicates.
- Using Math.random() in a script or spreadsheet for a drawing where fairness matters.Math.random() isn't cryptographically secure. This tool uses crypto.getRandomValues with rejection sampling to avoid modulo bias, making it more appropriate for drawings or decisions where the outcome needs to be fair.
- Assuming decimal mode simply rounds already-generated whole numbers.In decimal mode, the tool generates values directly within a discrete space scaled to the chosen decimal places, rather than rounding whole numbers after the fact, so the distribution stays uniform.
Frequently asked questions
The tool detects that there aren't enough distinct values in the chosen range and shows a clear error message, telling you to reduce the amount, widen the range, or allow duplicates.
They're generated with crypto.getRandomValues, the same cryptographic API used to generate security keys, and the tool also applies a rejection-sampling technique to avoid modulo bias.
Yes. Turn on decimal mode and set how many decimal places you want. Internally, the tool works within a discrete value space scaled to the chosen decimal places, so it can correctly validate sampling without repetition.
Up to 10,000 numbers per generation, a limit designed to keep the tool fast and avoid freezing the browser.
Alternatives
In a spreadsheet, functions like RANDBETWEEN (Excel) generate random numbers, though they aren't cryptographically secure. This tool is handy when you need a fast, fair result, for example for a drawing, without opening a spreadsheet or writing a formula.