Uniform Distribution Calculator
The continuous uniform distribution is the simplest continuous distribution there is: every point in an interval [a, b] is equally likely. Its density curve is a rectangle, so the probability of any sub-interval is nothing more than the ratio of that sub-interval's length to the total width. A bus arriving at a random moment, the rounding error of a measuring instrument, a random number produced by software, or an uncertain duration spread evenly between a best and a worst case all fit this model.
From the bounds a and b, this calculator returns the density (1/(b−a)), the probability between two values, the lower and upper tail probabilities, the mean, the variance, the standard deviation, the median, the quartiles, and any quantile you ask for. Interval bounds that fall outside the support are clipped automatically and reported as a warning. It is one of the calculations reached for most often in simulation work, in Monte Carlo setups, and in the opening weeks of a probability course.
Continuous Uniform Distribution Formulas
Density: f(x) = 1 / (b − a), a ≤ x ≤ b (0 elsewhere) Cumulative: F(x) = (x − a) / (b − a), a ≤ x ≤ b Interval: P(x₁ < X < x₂) = (x₂ − x₁) / (b − a) Mean: μ = (a + b) / 2 Variance: σ² = (b − a)² / 12 Std deviation: σ = (b − a) / √12 Median: m = (a + b) / 2 (the same as the mean) Quantile: x(q) = a + q·(b − a) Skewness: γ₁ = 0 Excess kurtosis: γ₂ = −1.2
The probability of an interval depends only on its length, never on its position: in U(0, 10), the intervals [1, 3] and [7, 9] are equally likely. Bounds that reach outside the support are clipped to a and b in the calculation.
How to Calculate
- Enter the lower bound (a) and the upper bound (b) of the distribution; b must be strictly greater than a.
- Write the ends of the interval whose probability you want into the x₁ and x₂ fields.
- If you like, enter a quantile probability (0.9, say) to find the value below which 90% of the observations fall; leave it blank if you do not need it.
- In the results, see that the density is constant, that the interval probability equals the ratio of lengths, and that the mean and the median coincide.
- The shaded rectangle shows the probability that was computed; a clipping warning means your bounds reached outside the support.
Worked Examples
The middle of the U(0, 10) range
For a variable spread uniformly between 0 and 10, the density is a constant 0.1. The probability of landing between 3 and 7 is 0.4 (40%), and the probability of falling below 3 is 0.3. The mean and the median are both 5, the variance is 8.33, and the standard deviation is 2.89; the 90% quantile falls at 9.
P(3 < X < 7): 0.4000 · P(X ≤ 3): 0.3000 · P(X ≥ 7): 0.3000
Bus waiting time: 0–20 minutes
If buses come every 20 minutes and you reach the stop at a random moment, the waiting time is distributed as U(0, 20). The probability of waiting between 5 and 15 minutes is 0.5, and the probability of waiting less than 5 minutes is 0.25. The average wait is 10 minutes with a standard deviation of 5.77 minutes, and 95% of passengers wait at most 19 minutes.
P(5 < X < 15): 0.5000 · P(X ≤ 5): 0.2500 · P(X ≥ 15): 0.2500
Measurement rounding error: −0.5 to 0.5
The error of a measurement rounded to the nearest whole number is distributed as U(−0.5; 0.5), and the density equals 1. The probability that the error stays within ±0.1 is 0.2. The mean error is 0, the variance is 0.0833, and the standard deviation is 0.2887 — the familiar 1/√12 factor of measurement uncertainty calculations.
P(-0.1 < X < 0.1): 0.2000 · P(X ≤ -0.1): 0.4000 · P(X ≥ 0.1): 0.4000