OmniFeed Search

Random number generator

Pick one number, or up to 10,000, between any two numbers you choose, with both ends included and every number equally likely. Tick No repeats when each number has to be different, as in a raffle or a lottery pick. It runs in your browser; nothing you enter is uploaded.

How the numbers are picked

Every number comes from crypto.getRandomValues, the random number generator browsers provide for cryptography, not from Math.random. The browser seeds it from the operating system's secure generator, so nobody can work out the next number from the ones before it.

The generator also makes sure no number in your range is favored. For 1 to 6, the generator draws a random 32-bit number, from 0 to 4,294,967,295, and keeps the remainder after dividing by 6, which gives 0 to 5. Adding the lowest number, 1, gives 1 to 6.

But the 4,294,967,296 possible 32-bit numbers don't split evenly into 6 groups: four are left over, and they'd make 1 to 4 come up a tiny bit more often than 5 and 6. The generator throws those four values away and draws again, so every number has exactly the same chance. A range too wide for 32 bits, up to 100 digits long, gets as many random bits as it needs and the same check.

With decimal places set to 2, the numbers from 0 to 1 are 0.00, 0.01 and so on up to 1.00: 101 numbers, each equally likely. Every result has exactly that many decimal places, so 0.50 stays 0.50.

Repeats or no repeats

With No repeats unticked, each pick is a fresh draw, like rolling a die again, so the same number can come up twice. That happens sooner than most people expect. Ten numbers from 1 to 100 have about a 37% chance of including at least one pair, and for six numbers from 1 to 49 it's about 27%.

With No repeats ticked, the tool works like drawing tickets from a hat without putting them back. If you ask for more different numbers than the range holds, such as 11 from 1 to 10, you get an error saying so, not a shorter list. Ask for every number in the range, such as 30 from 1 to 30, and you get each one once in a random order, which is a quick way to shuffle a numbered list.

Picking winners, lottery numbers and samples

Other ways to get random numbers

More in everyday tools

Other tools