🧮
🧮 Math & statistics

Random Number Generator (range, count, no repeats)

Results update as you type.

Your numbers

Understanding the random number generator — concept and principle

This tool draws random numbers within a range you choose, with or without repeats, as whole numbers or decimals, sorted or in draw order. It also shows the count, sum, average, the number of possible values and the number of possible different sets. Use it for classroom draws, picking winners, games, sampling and practice lottery-style draws.

Random draw of six numbers6 balls from 1–45, no repeats32022233142sum 141 · average 23.5Possible sets C(45, 6)8,145,060one example draw · each set equally likely
Every one of the 8,145,060 possible sets has the same chance; this draw is one example.

How it is calculated

Changing any input, including "Draw number", produces a new draw.

The principle

A fair draw needs every allowed value (or set) to be equally likely. Computers produce random bits; turning them into a number in a range by taking a remainder slightly favours small values unless the range divides the number of bit patterns evenly. Rejection sampling fixes this by discarding the few raw values that would cause bias and drawing again. The Fisher–Yates shuffle draws without repeats by swapping each chosen value out of the remaining pool, which gives every ordering the same chance.

Worked example

Default inputs: 1 to 45, 6 numbers, no repeats, whole numbers, sorted. The draw shown on the page was:

  1. Numbers: 3, 20, 22, 23, 31, 42.
  2. Count 6; sum 3 + 20 + 22 + 23 + 31 + 42 = 141.
  3. Average 141 ÷ 6 = 23.5.
  4. Values possible in the range: 45.
  5. Possible different sets: C(45, 6) = 8,145,060.

Your own draw will show different numbers; the last two figures stay the same.

How to read the result

Each set of 6 from 45 has the same chance, 1 in 8,145,060. Sets that look patterned, like 1, 2, 3, 4, 5, 6, are exactly as likely as any other. The average of a fair draw tends toward the middle of the range (23 here) over many draws, but any single draw can differ widely.

Common mistakes

Keep in mind: This tool is for everyday use only. It is not certified for official lotteries, gambling, legal draws or generating security keys.

Frequently asked questions

Is this truly random?

It uses the browser's cryptographic generator, which is designed to be unpredictable; that is suitable for everyday draws.

How do I draw again with the same settings?

Change the "Draw number" field; each new value triggers a new draw.

What are the odds of matching all 6 numbers from 45?

1 in 8,145,060 for a fair draw.

Sources: W3C Web Cryptography API, crypto.getRandomValues · D. E. Knuth, The Art of Computer Programming, Vol. 2, §3.4.2 (random sampling and shuffling)

Checked 9 Nov 2026. Web Crypto API, crypto.getRandomValues (W3C); unbiased bounded integers by rejection sampling; random sampling without replacement by the Fisher–Yates shuffle (Knuth, The Art of Computer Programming vol. 2, §3.4.2, Algorithm P).

🧮 All math & statistics tools →🌍 Calculators by country →