Skip to content
Omnikalc

Continuous uniform distribution calculator

Enter the bounds a and b to get P(X ≤ x), the probability of an interval, the density, the mean, the variance and the standard deviation.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

P(X ≤ x)

0.3

P(c ≤ X ≤ d)

0.3

P(X > x)
0.7
Density 1 ÷ (b − a) inside [a, b]
0.1
Mean (a + b) ÷ 2
5
Variance (b − a)² ÷ 12
8.3333
Standard deviation
2.8868
Value with P(X ≤ x) = 0.9 (90th percentile)
9

The continuous uniform distribution

A random variable X follows a uniform distribution on [a, b] when every value in the interval is equally likely. Its density is flat: 1 ÷ (b − a) between a and b, and zero outside. It describes a random arrival time within a known window, a rounding error between −0.5 and 0.5, or a random point on a segment, and it is the starting point of computer simulation, since random-number generators produce uniform values on [0, 1].

The formulas

  • P(X ≤ x) = (x − a) ÷ (b − a) for x between a and b (0 below a, 1 above b).
  • P(c ≤ X ≤ d) = (length of the overlap of [c, d] with [a, b]) ÷ (b − a).
  • Mean (a + b) ÷ 2, the midpoint.
  • Variance (b − a)² ÷ 12, so the standard deviation is (b − a) ÷ √12 ≈ 0.289 × (b − a).
  • The p-th percentile is a + p × (b − a).

Example

X is uniform on [0, 10]:

  • P(X ≤ 3) = 3 ÷ 10 = 0.3;
  • P(2 ≤ X ≤ 5) = 3 ÷ 10 = 0.3;
  • the density is 0.1, the mean 5, the variance 8.33 and the standard deviation 2.89;
  • the 90th percentile is 9.

A practical reading: if a bus comes every 10 minutes and you arrive at a random time, your wait is uniform on [0, 10]. You wait 5 minutes on average, and there is a 30% chance of waiting 3 minutes or less.

Probabilities are lengths

For a uniform distribution, a probability is simply a ratio of lengths. The probability of any single exact value is zero; only intervals have positive probability. That is why P(X ≤ x) and P(X < x) are equal.

Uses

  • Simulation: any distribution can be generated from a uniform value U on [0, 1] by applying the inverse of its cumulative distribution function (the inverse transform method).
  • Measurement and rounding error: a value rounded to the nearest unit has an error uniform on [−0.5, 0.5], with a standard deviation of 1 ÷ √12 ≈ 0.29 unit. Metrology uses this to turn a tolerance ±h into a standard uncertainty h ÷ √3.
  • Bayesian statistics: a uniform prior expresses no preference among values in a range.

Discrete uniform

For a fair die or a random integer from 1 to n, the distribution is discrete: each value has probability 1 ÷ n, the mean is (n + 1) ÷ 2 and the variance (n² − 1) ÷ 12.

Frequently asked questions

What are the mean and variance of a uniform distribution?

The mean is (a + b) ÷ 2 and the variance is (b − a)² ÷ 12.

How do I find a probability with a uniform distribution?

Divide the length of the interval by b − a: P(c ≤ X ≤ d) = (d − c) ÷ (b − a) inside [a, b].

What is the standard deviation of a rounding error?

A value rounded to the nearest unit has an error uniform on ±0.5, with an SD of 1 ÷ √12 ≈ 0.29.

What is the difference between continuous and discrete uniform?

Continuous covers every real value in [a, b]; discrete covers a finite set of equally likely values, like a die.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.