Why use this calculator
A random draw is only fair if every value in the range is equally likely, and most quick implementations fail that test in a way nobody notices. Taking the remainder of a large random number divided by the range size quietly favours the lower values, a flaw called modulo bias, and it is why a naive raffle script picks early ticket numbers slightly more often than late ones.
This generator uses the browser's cryptographic random source with rejection sampling, so every value in the range genuinely has the same chance. It also draws up to ten numbers at once, tells you the size of the sample space, and shows how many repeats came up, which is the fastest way to see that independent draws are not the same as drawing without replacement.
How to use it
- Set the minimum value to the lowest number you want to be able to come up and the maximum to the highest; both ends are included in the range, so one to six really does cover all six faces of a die.
- If you accidentally enter them the wrong way round the calculator swaps them rather than returning nothing.
- Set the quantity to how many numbers you want in a single draw, up to ten.
- Each time you run the calculator you get a completely fresh set of numbers, because nothing is carried over from the previous draw.
- Whole numbers only are produced, so for decimal values pick a wider integer range and divide the result yourself.
What each result means
- Random number
- The value drawn this run. Running the calculator again produces a fresh, independent draw with no memory of this one.
- Random number 1
- The first value in a multiple draw. Each numbered draw is independent of the others, so values can repeat.
- Range
- The inclusive span the draw was taken from, shown after any correction for a minimum entered above the maximum.
- Possible outcomes
- How many different values could have come up, which is the maximum minus the minimum plus one.
- Odds of any one value
- The chance of any particular number being drawn, which is one divided by the number of possible outcomes.
- Sum of the draws
- The total of all the numbers drawn this run, useful when the draw is standing in for dice.
- Average of the draws
- The mean of this run. Over many runs it converges on the midpoint of the range, but any single run can sit well away from it.
- Repeated values
- How many of the draws duplicated an earlier one. Independent draws allow repeats, unlike a raffle barrel where tickets are removed.
The formula
Each draw is value = minimum + R
The plus one exists because both endpoints are included. R comes from a 32-bit cryptographic random value, and any value at or above the largest exact multiple of the range is thrown away and redrawn, which removes the bias that a plain remainder operation would introduce. The probability of any single value is therefore one divided by the count of outcomes.
How this number is used in practice
The most common practical use is a fair draw: a raffle, a prize winner, a random audit sample or deciding who goes first. For anything with a real prize attached, write down the range and the draw method before you run it, and take a screenshot of the result.
Regulators and members alike accept a documented, repeatable process far more readily than an unrecorded click, and the documentation costs nothing.
The second big use is sampling. Auditors, quality inspectors and researchers pick random record numbers precisely so the selection cannot be influenced by the person doing the picking. The key detail is that these draws are independent, which means the same number can appear twice.
If you need a sample without replacement, for example ten different staff members out of two hundred, draw more numbers than you need and discard the duplicates, or draw one at a time and skip any repeat.
Game use is the third. A die is a draw from one to six, two dice are two separate draws rather than one draw from two to twelve, and treating them as the same thing is the classic beginner's error in probability. Drawing twice and reading the sum row gives the correct distribution, where seven is six times more likely than two.
Worked examples
A single draw from 1 to 100
One number between 1 and 100, from 100 possible outcomes, each with a 1 in 100 chance.
Rolling two six-sided dice
Two draws from 1 to 6, with a sum between 2 and 12 and 6 possible outcomes on each die.
Picking a raffle winner from 500 tickets
One number between 1 and 500, giving every ticket a 1 in 500 chance of winning.
Drawing 10 audit samples from 2,000 records
Ten independent numbers between 1 and 2,000, where roughly a 2 in 100 chance exists that two of them repeat.
When people use it
- Running a raffle, prize draw or random giveaway
- Selecting a random sample of records for an audit or quality check
- Rolling virtual dice or generating game values
- Choosing an impartial order for presentations, interviews or chores
- Producing quick test data for a spreadsheet or a development database
Tips
- Both the minimum and the maximum are included, so a range of 1 to 6 has six outcomes, not five.
- Draws are independent. If you need distinct values, draw extras and discard repeats rather than assuming they cannot occur.
- For a prize draw, record the range and the result immediately. An undocumented draw is impossible to defend later.
- Two dice are two separate draws. A single draw from 2 to 12 gives every total the same chance, which is not how dice behave.
- For decimals, draw from a larger integer range and divide. Drawing from 0 to 1000 and dividing by 1000 gives three decimal places.
- A run of similar numbers is normal, not a fault. Genuine randomness produces clusters far more often than people expect.
What it assumes, and where it stops being accurate
- Every value in the range is equally likely, with no weighting, exclusions or previously drawn numbers removed.
- Draws are with replacement, so the same value can appear more than once in a multiple draw.
- Only whole numbers are produced; fractional results must be derived by scaling a wider integer range.
- The range is capped at plus or minus one billion and the quantity at ten per run, to keep results readable and fast.
- Where the cryptographic random source is unavailable the generator falls back to the standard pseudo-random source, which is fine for games but not for secrets.
Terms used on this page
- Uniform distribution
- A distribution in which every outcome in the range has exactly the same probability.
- Modulo bias
- The skew introduced when a large random value is folded into a smaller range with a plain remainder operation.
- With replacement
- Sampling where each draw is independent and previously drawn values remain available.
- Entropy source
- The unpredictable physical input, such as timing jitter, that seeds a cryptographic random generator.
Questions people ask
- Are these numbers truly random?
- They come from the browser's cryptographic random source, which is seeded from operating system entropy rather than a predictable formula. That is as close to true randomness as software gets and is far stronger than the ordinary pseudo-random function. For scientific purposes hardware entropy sources exist, but for draws and sampling this is more than sufficient.
- What is modulo bias and why does it matter?
- If you take a random 32-bit number and simply take its remainder when divided by your range, the lower values come up slightly more often, because the total number of 32-bit values is not an exact multiple of most ranges. This generator discards and redraws any value in that uneven tail, so every outcome is equally likely.
- Can the same number come up twice?
- Yes, and it should. Each draw is independent, like rolling a die repeatedly rather than pulling tickets from a barrel. In a small range with several draws, repeats are likely. The repeated values row tells you how many occurred so you can discard them if you need distinct numbers.
- Can I use this to generate a password?
- Use the dedicated password generator instead. It draws from a full character set, reports the entropy in bits, and applies the same unbiased sampling across letters, digits and symbols. A string of random digits is far weaker than the same length drawn from an eighty-eight-character alphabet.
- Why does the same range keep producing similar numbers?
- Genuine randomness clusters. Over a hundred draws from one to ten you will see runs of the same value and long gaps where a value never appears, and both are expected. Human intuition treats an even spread as random and a clustered one as broken, which is precisely backwards.
- How do I draw a sample without replacement?
- Draw more numbers than you need and delete any duplicates, or draw one at a time and redraw whenever you hit a value already used. For large ranges relative to the sample size, duplicates are rare enough that a single pass with a quick check is usually enough.
Use this with
Random Number Generator answers one part of the question. These pick up where it stops: Probability Calculator, Sample Size Calculator, Password Generator and Mean, Median, Mode Calculator.
Where these figures come from
This calculation is jurisdiction-neutral arithmetic. No country-specific rules are applied.
- NIST: Random Bit Generation project. Standards for deterministic and entropy-source random bit generators
- MDN: Math.random(). Why Math.random is pseudo-random and unsuitable for security use
- MDN: Crypto.getRandomValues(). The cryptographically strong random source this generator uses in the browser
Random Number Generator produces an estimate for general information. It is not financial, tax, medical, legal or engineering advice. read the full disclaimer. Spotted a wrong number? Report it and it gets fixed. The form picks up this calculator and the inputs you used.