Skip to content

Random Number Generator

Updated:

Generate random integers or fixed-precision decimals within a range. Enter the minimum, maximum, and number of values, then choose whether duplicates are allowed.

Generate Random Numbers

Input Fields
If enabled, the result will update automatically when you change any value.

Random Number Formula

Formula
\[N=\lfloor b\,10^d\rfloor-\lceil a\,10^d\rceil+1,\qquad P(X=x)=\frac{1}{N}\]

Where:

  • \(a\) — the minimum entered
  • \(b\) — the maximum entered
  • \(d\) — decimal places selected; \(d=0\) for integers
  • \(N\) — the number of eligible values on that precision grid
  • \(P(X=x)\) — the probability of drawing any one eligible value on a single draw

The minimum is rounded up and the maximum down to the selected precision, so generated values stay within both bounds. Each eligible value has the same chance on a single draw.

Random Number – Calculation Example

Example: keep the default settings: Minimum 1, Maximum 100, How many numbers? 1, Allow duplicates? Yes, and Number type Integers. Suppose you want to know the chance of drawing 37.

\[N=\lfloor100\rfloor-\lceil1\rceil+1=100,\qquad P(X=37)=\frac{1}{100}=1\%\]

Result: the generator returns one integer from 1 to 100. The value 37 is one possible result, with a 1% chance on this draw; your actual result will vary.

How to use the calculator

  1. Enter the lower bound in Minimum and the upper bound in Maximum. The minimum must not exceed the maximum.
  2. Set How many numbers? to the number of values you need, from 1 to 1,000.
  3. Choose Allow duplicates? Select Yes if a value may appear more than once, or No if every result must be distinct.
  4. Choose Number type: Integers or Decimals. For decimals, set Decimal places from 1 to 10. This determines which values can be drawn, not just how they look.
  5. Choose Sort results: Do not sort, Ascending, or Descending. Read the generated numbers, or use Generate again for a new draw and Copy to copy the list.

When you request more than one number, the result also shows their sum and mean. These describe the numbers drawn, not every number available in the range. If you change an input after generating a list, run the calculator again to apply the new settings.

What a random number result means

This generator selects from a discrete set of eligible values between your bounds, including either endpoint when it falls on the selected precision grid. With integers from 1 to 100, there are 100 possibilities. With two decimal places from 1 to 2, there are 101 possibilities: 1.00, 1.01, and so on through 2.00. Each eligible value has the same probability on the first draw. For a closer look at equal-probability outcomes, see the Uniform Distribution calculator.

With Allow duplicates? Yes, each draw is independent: the same number can appear repeatedly, and an earlier result does not change the chances on the next draw. With No, values are sampled without replacement. Each eligible value still has the same chance of appearing in any particular draw position, but once selected, it cannot appear again in that list. For example, drawing three distinct integers from 1 to 100 gives any specified integer a \(3/100\) chance of appearing somewhere in the list.

Sorting changes only the displayed order, not which values were drawn. An ascending list can therefore look patterned even though its values were selected randomly. A short random list can also contain clusters, gaps, or repeated values when duplicates are allowed; randomness does not require a visually even spread. If you need to calculate the chance of a particular event rather than generate outcomes, use the Probability calculator.

Limits and practical tips

  • Check the available values. Bounds must each be between −1,000,000 and 1,000,000. If duplicates are off, the requested count cannot exceed the number of eligible values.
  • Choose precision deliberately. Decimal results lie on a grid: two places means steps of 0.01, while three places means steps of 0.001. Bounds that fall between grid points are not themselves eligible. A very narrow range may contain no value at the chosen precision.
  • Keep an unsorted list when draw order matters. Sorting is convenient for checking the range or spotting duplicates, but it removes the original sequence from view.
  • Record results you need to reproduce. Generate again makes a fresh draw; the calculator does not offer a seed for recreating the same list. Copy the values before leaving the page.

The generator uses the browser’s secure random-number facility and avoids favoring some eligible values through a simple remainder calculation. It needs a browser where that facility is available. Randomly generated data can be useful for examples or simulations, but a small sample may differ substantially from the distribution you expect; for a measure of uncertainty across outcomes, see the Shannon Entropy calculator.

Frequently Asked Questions

How can I generate a random number by hand without favoring some results?

Use equally likely outcomes and discard any that do not fit evenly into your range. For a number from 1 to 10, draw two independent digits from 0 to 9 to make a value from 00 to 99. Discard 90–99, then take the last digit of a remaining value and add 1. Each answer has nine equally likely ways to occur.

What is the chance of getting a particular number at least once?

With duplicates allowed, the chance of seeing a specified value at least once in \(k\) draws from \(N\) eligible values is \(1-(1-1/N)^k\). For example, three draws from 1 to 10 give a \(1-(9/10)^3=27.1\%\) chance. Without duplicates, the chance is \(k/N\), provided \(k\leq N\).

How likely are duplicate numbers in a list?

With duplicates allowed, repeats become more likely as the list grows. For \(k\leq N\), the chance of at least one repeat is \(1-\prod_{i=0}^{k-1}(N-i)/N\), where \(N\) is the number of eligible values. Three draws from 1 to 10 have a 28% chance of containing a repeat. If you request more than \(N\) draws, a repeat is certain.

Do the generated numbers have units?

No. The generator produces numbers, not measurements; you decide what they represent. For money in dollars, two decimal places can represent cents. For a whole-number percentage, use bounds such as 0 and 100; for a probability, use decimal bounds such as 0 and 1. Convert your bounds to the intended unit before generating values.

What happens if the range includes negative numbers or has identical bounds?

Negative values and zero follow the same rules as positive values. For example, integer bounds of −2.7 and 2.7 allow −2, −1, 0, 1, and 2. Identical bounds produce one eligible value only if that value matches the selected precision. You can draw it repeatedly with duplicates allowed, but you cannot request multiple distinct results from it.

Is this generator suitable for raffles or security-sensitive decisions?

It uses the browser’s secure random-number facility, which is preferable to a simple predictable random function. However, this page does not provide a verifiable draw record or a way for others to independently audit the selection. For a regulated raffle, financial decision, or other high-stakes use, follow the applicable rules and use an appropriately audited process.

Leave a Reply

Your email address will not be published. Required fields are marked *