About the Uniform Distribution Calculator
This uniform distribution calculator handles the continuous uniform distribution U(a, b), where every value between a lower bound a and an upper bound b is equally likely. Enter the bounds and choose the probability you need — below a value, above a value, or between two values — and it returns the probability along with the density height 1 ÷ (b − a), the mean, median, variance, standard deviation and any percentile you ask for.
Uniform models appear in homework problems (a bus arrives at a random time in a 20-minute window), in simulation and Monte Carlo work (random number generators produce U(0, 1) values), in rounding-error analysis, and as an uninformative prior in Bayesian statistics. The calculator is aimed at students checking answers and at analysts who want a quick, reliable figure.
Because the density is flat, every probability is simply a length ratio: the part of the interval you care about divided by the total width b − a. Values outside [a, b] are clipped, so P(X < x) is 0 below a and 1 above b. For the discrete version (such as a fair die), use the discrete probability distribution calculator instead.
With the default inputs, the probability is 0.35. Change any value above to recalculate instantly.
How to use the uniform distribution calculator
- 1Enter the lower bound a and upper bound b of the distribution.
- 2Choose whether you want the probability below a value, above a value or between two values.
- 3Enter x₁ (and x₂ for a between probability).
- 4Optionally enter a percentile to find the value below which that share of outcomes falls.
- 5Read the probability, then the mean, variance and standard deviation.
Formula and method
The continuous uniform distribution has a constant density 1 ÷ (b − a) between a and b and zero elsewhere, so the area under it over any sub-interval is just the sub-interval’s length times that height. The cumulative distribution is F(x) = (x − a) ÷ (b − a), clipped to 0 below a and 1 above b, and every probability the calculator reports is a difference of F values.
The mean and median both sit at the midpoint (a + b) ÷ 2. The variance (b − a)² ÷ 12 comes from integrating (x − μ)² against the flat density; the standard deviation is (b − a) ÷ √12 ≈ 0.2887 × (b − a). The p-th percentile is a + p(b − a). Strict and non-strict inequalities give the same probability because a single point has zero probability.
- a, b
- Lower and upper bounds of the distribution
- x₁, x₂
- Values that define the probability region
- f(x)
- Probability density (height of the rectangle)
- μ, σ²
- Mean and variance
Worked examples
Bus arrives uniformly within 20 minutes: wait between 5 and 12 minutes
With U(0, 20), the chance of waiting between 5 and 12 minutes is (12 − 5) ÷ 20 = 0.35. The mean wait is 10 minutes, the variance is 20² ÷ 12 = 33.33 and the standard deviation is 5.77 minutes. Ninety percent of waits are shorter than 0 + 0.9 × 20 = 18 minutes.
Random number between 1 and 6: probability it is below 2.5
For U(1, 6), P(X < 2.5) = (2.5 − 1) ÷ 5 = 0.3. The mean is 3.5 and the variance is 25 ÷ 12 = 2.083. The first quartile (25th percentile) is 1 + 0.25 × 5 = 2.25.
Manufacturing tolerance: part length U(49.8, 50.4) mm, longer than 50.25 mm
The width is 0.6 mm, so the density is 1 ÷ 0.6 = 1.667 per mm. P(X > 50.25) = (50.4 − 50.25) ÷ 0.6 = 0.25, meaning a quarter of parts exceed 50.25 mm. The standard deviation is 0.6 ÷ √12 = 0.173 mm around a mean of 50.1 mm.
Frequently asked questions
What is a uniform distribution?+
A continuous uniform distribution U(a, b) gives every value between a and b the same likelihood. Its density is a flat rectangle of height 1 ÷ (b − a), so the probability of any interval is proportional to its length.
How do you calculate probability in a uniform distribution?+
Divide the length of the interval you care about by the total width b − a. For U(0, 20), P(5 < X < 12) = 7 ÷ 20 = 0.35. Clip the interval to [a, b] first if it extends past the bounds.
What is the mean and variance of a uniform distribution?+
The mean is (a + b) ÷ 2, the midpoint of the interval, and the variance is (b − a)² ÷ 12. The standard deviation is therefore (b − a) ÷ √12, about 28.9% of the width.
Does it matter whether I use < or ≤?+
No. For a continuous distribution the probability of any single exact value is zero, so P(X < x) and P(X ≤ x) are equal. That is not true for discrete distributions such as dice rolls.
What is the difference between discrete and continuous uniform distributions?+
A discrete uniform distribution has a finite set of equally likely values, like the faces of a die, each with probability 1 ÷ n. The continuous version covers every real number in an interval. Their variances also differ: (n² − 1) ÷ 12 for consecutive integers versus (b − a)² ÷ 12.
How do I find a percentile of a uniform distribution?+
The p-th percentile is a + p × (b − a). For U(0, 20), the 90th percentile is 18. This is also how computers turn a U(0, 1) random number into a uniform value on any interval.