HandyBench

Random Number Generator

Random numbers in any range, instantly.

How to use the Random Number Generator

  1. 1 Set the minimum and maximum values.
  2. 2 Choose how many numbers to generate, and whether repeats are allowed.
  3. 3 Click Generate and copy the results.

How a number is picked

The tool asks crypto.getRandomValues for a 32-bit unsigned integer, divides it by 232 to get a fraction in [0, 1), multiplies by the size of your range and rounds down. The range size is max - min + 1, so both ends are inclusive: with 1 and 6 you get 1 + floor(u × 6), which gives each of 1 to 6 with equal probability. This source is the browser's secure generator, not Math.random. Because 232 does not divide evenly by most range sizes, there is a tiny bias, about range / 4.3 billion. For a range of 100 that is far below one in a million, and irrelevant for games, raffles and classroom draws.

Repeats and "no repeats" mode

With repeats allowed, each number is an independent draw, so the same value can come up twice, just like rolling a die several times. With "No repeats" ticked, the tool lists every integer from min to max, shuffles the list with a Fisher-Yates shuffle (swapping each position with a random earlier one) and takes the first N. This is like drawing numbered balls from a bag. The total number of ways to draw 6 unique values from 1 to 49 is 49 × 48 × 47 × 46 × 45 × 44 / 720 = 13,983,816 combinations.

SettingExamplePossible outcomes
1 to 100, one number, repeats allowed73100
1 to 6, five numbers, repeats allowed2, 6, 6, 1, 465 = 7,776
1 to 49, six numbers, unique8, 17, 23, 31, 40, 4613,983,816 (order ignored)

Limits and edge cases

  • Result count. You can ask for between 1 and 10,000 numbers at a time. Larger values are clamped.
  • Unique needs room. If you request more unique numbers than the range holds, such as 8 from 1 to 5, you get an error instead of a short list.
  • Decimals. Minimum and maximum are rounded down to whole numbers; the tool produces integers only.
  • Huge unique ranges. No-repeat mode builds the whole range in memory, so unique results from something like 1 to 1,000,000,000 will be slow or fail. Use repeat mode there; collisions are rare.
  • Max below min. This is rejected with a message.

Common mistakes

  • Expecting evenly spread results. True randomness clusters. Seeing 7 twice in ten draws from 1 to 20 is normal, not a sign of a bug.
  • Using it for official lotteries. It is fine for fair informal draws, but regulated draws need audited procedures and a record of the process.
  • Re-rolling until you like it. If a draw has to be fair, generate once and accept the result.

For physical-style outcomes use the dice roller or the coin flip. To choose from a named list, the random picker is more convenient, and for secrets use the password generator.

Examples

  • ▸ Pick a number between 1 and 100 for a game.
  • ▸ Draw 6 unique numbers from 1–49 for a lottery-style pick.

Frequently asked questions

Are the numbers truly random?

They use your browser’s cryptographically secure random generator (crypto.getRandomValues), which is far stronger than the standard Math.random and suitable for fair draws.

What does “no repeats” do?

It returns unique numbers with no duplicates, like drawing balls from a bag. The count cannot exceed how many numbers fit in your range.

Is the range inclusive?

Yes. Both the minimum and maximum you enter can appear in the results.

How many numbers can I generate at once?

Between 1 and 10,000 per click. In unique mode you cannot request more numbers than the range contains, so 8 unique numbers from 1 to 5 returns an error instead of a short list.

Can it generate decimals or negative numbers?

Negative integers work, since the minimum can be below zero. Decimals do not: the tool produces whole numbers only and rounds the minimum and maximum down.