TanodTools

Random number generator

Choose a range and how many numbers you want. Each one is drawn evenly from your browser's secure random source.

Runs entirely in your browser

0 gives whole numbers.

Up to 10,000 numbers per draw, bounds of up to 30 digits and up to 10 decimal places. Results are not saved; reloading the page clears them.

How to generate random numbers

  1. Type the smallest and largest value. Both ends can come up, and negative numbers work.
  2. Set how many numbers you want, and tick No repeats if every number must be different.
  3. Press Generate, then copy the list or download it as a text file.

Why a secure generator, and what "random" has to mean here

A fair draw means every allowed value is equally likely and one draw tells you nothing about the next. Math.random() is fast but is a predictable sequence in disguise, and it is fine for animations, not for a prize draw. The browser's crypto.getRandomValues is seeded from the operating system and is the right source for anything people might argue about.

Turning raw random bits into a number from 1 to 6 is where many tools go wrong. A 32-bit value has 4,294,967,296 possibilities, which 6 does not divide, so using the remainder makes the low faces fractionally more likely. The fix is rejection sampling: the largest multiple of the range size below 232 is the cut-off, and a draw above it is discarded and redrawn. For ranges wider than 32 bits the tool draws exactly as many bits as needed and rejects anything over the range, using big integers so values near 9,007,199,254,740,991 stay exact.

Decimals use the same idea on a grid. With two decimal places, the range 0 to 5 is treated as the integers 0 to 500, one is drawn and the point is put back, which keeps every grid value equally likely instead of rounding a continuous number.

Tips

  • To pick people rather than numbers, paste a list into the random name picker.
  • Need a secret, not a number? The password generator uses the same random source with character sets.
  • Want a unique identifier instead of a small number? Try the UUID generator.

Questions

Are the numbers really random?

They come from crypto.getRandomValues, the same secure generator browsers use for encryption keys, not from Math.random. Each value in your range is equally likely. The generator is good enough for games, raffles and picking a sample; it has not been audited for regulated lotteries.

What is modulo bias, and does this tool have it?

Taking a random 32-bit number and keeping the remainder after dividing by the range size makes some results slightly more likely whenever the range does not divide 232 evenly. This tool throws away any draw that falls in the uneven leftover and draws again, so every value has exactly the same chance. That also holds for huge ranges, which are handled with big integers.

How does "No repeats" work, and when does it fail?

The tool draws each new number and skips any that has appeared, or for small ranges shuffles the whole range and takes the first few. If you ask for more different numbers than the range holds, such as 7 from 1 to 6, it tells you instead of looping forever.

What happens if the minimum is bigger than the maximum?

The two values are swapped and the result line says so. Typing 10 and 1 gives the same draw as typing 1 and 10.

How do decimals work?

Set decimal places to 2 and the range 0 to 1 becomes the 101 values 0.00, 0.01 up to 1.00, each equally likely. The results always show the full number of places, so 0.50 stays 0.50. The bounds themselves cannot have more decimals than you chose.

Can I use this for a lottery pick or a dice roll?

For a dice roll use 1 to 6. For a lottery ticket tick No repeats, for example 6 numbers from 1 to 49 sorted smallest first. Random picks give you no better odds than any other numbers. Picks are not stored or sent anywhere.