🧮
🧮 Math & statistics

Uniform Distribution Calculator

Results update as you type.

Your numbers

Understanding the uniform distribution calculator — concept and principle

A uniform distribution calculator handles the case where every value between a minimum a and a maximum b is equally likely. It returns the probability that the variable falls in a chosen sub-interval, along with the mean and variance. Typical examples are a random number from a generator, the arrival time of a bus within a known 10-minute window, rounding errors, and the position of a randomly placed point on a line.

Uniform distribution as a 10-piece barOn 0 to 10, the stretch from 2 to 5 is 3 of 10 equal pieces, so the probability is 0.3.Uniform: equal lengths, equal chances012345678910a = 0b = 103 of 105 − 2÷10 − 0=0.3mean (0+10)÷2 = 5variance 10²÷12 = 8.33
The probability is just the share of the length: 3 pieces out of 10 gives 0.3.

How it is calculated

The density is constant, f(x) = 1 ÷ (b − a) for a ≤ x ≤ b and zero elsewhere. All values share one unit, and b must be greater than a. Because the variable is continuous, including or excluding the endpoints does not change the probability.

The principle

"Equally likely" means the probability is spread evenly, like butter of the same thickness over a slice of bread. The total area under the density must equal 1, so its height is 1 ÷ (b − a). The probability of any sub-interval is then just its length times that height, which is the length of the sub-interval divided by the length of the whole range. The mean sits at the centre by symmetry, and the variance follows from integrating (x − mean)² × f(x) over the range, giving (b − a)²/12.

Worked example

  1. Inputs: a = 0, b = 10, from = 2, to = 5.
  2. Clipped interval: max(2, 0) = 2 to min(5, 10) = 5, length 3.
  3. P(2 < X < 5) = 3 ÷ (10 − 0) = 0.3.
  4. Mean = (0 + 10) ÷ 2 = 5.
  5. Variance = (10 − 0)² ÷ 12 = 100 ÷ 12 ≈ 8.3333; SD ≈ 2.887.
How P(from < X < to) changes with Max bHow P changes with Max b0.10.20.30.40.50.62.557.51012.51520Example: 0.3Max b
Each point is the calculator re-run with only “Max b” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Max bP(from < X < to)
2.50.2
50.6
7.50.4
100.3
12.50.24
150.2
200.15

How to read the result

The probability is simply the fraction of the range you cover: 30% of the range gives a 30% chance. Unlike the normal distribution, there is no clustering near the mean; values near the edges are just as likely as values in the middle.

Common mistakes

Keep in mind: Treating values as uniform is an assumption of complete ignorance within the range. If you have any reason to think some values are more likely, the uniform model will misstate the probabilities.

Frequently asked questions

What is the probability of one exact value?

Zero, because a single point has no length.

How do I generate a uniform number between a and b?

Take a standard random number U between 0 and 1 and compute a + (b − a) × U.

Why divide by 12 in the variance?

It comes from integrating the squared distance from the midpoint over the range; for a range of length L the result is L²/12.

Sources: Ross, S. M., A First Course in Probability (Pearson) · NIST/SEMATECH e-Handbook of Statistical Methods, Section 1.3.6.6.2 Uniform Distribution

Checked 8 Nov 2026. Standard formulas, computed in your browser with double-precision numbers.

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