Understanding the Continuous Uniform Distribution
The continuous uniform distribution describes a random variable that is equally likely to take any value in an interval [a, b]. Every point in that interval carries the same probability density, so the graph of its density is a flat rectangle rather than a bell curve. It is the simplest continuous distribution and the natural model whenever "any value in a range is equally plausible" — for example, the fractional part of a measurement, the position of a randomly dropped point on a line, or the output of an idealized random number generator.
The four formulas
- Probability density (PDF): f(x) = 1/(b − a) for a ≤ x ≤ b, and 0 outside that interval. The density is constant. Because it is a density and not a probability, it can exceed 1 when the interval is narrower than 1 unit — on [0, 0.5] the density is 2.
- Cumulative probability (CDF): F(x) = P(X ≤ x) = (x − a)/(b − a) for a ≤ x ≤ b. It is 0 below a and 1 above b, and it rises in a straight line between them. For a sub-range, P(c ≤ X ≤ d) = (d − c)/(b − a).
- Mean: μ = (a + b)/2, the midpoint of the interval.
- Variance and standard deviation: σ² = (b − a)²/12, so σ = (b − a)/√12 ≈ 0.2887(b − a). The inverse CDF (quantile) is x = a + p·(b − a).
Why the density is 1/(b − a)
A valid probability density must enclose a total area of exactly 1. The uniform density is a rectangle of width (b − a), so its height must be 1/(b − a) for the area (width × height) to equal 1. That single fact generates every other formula: the CDF is the running area from a up to x, and the variance (b − a)²/12 comes from integrating (x − μ)² over the interval.
Common reference points
- Standard uniform [0, 1]: density 1 everywhere, mean 0.5, variance 1/12 ≈ 0.0833, standard deviation 1/√12 ≈ 0.2887. This is what most software's rand() function approximates.
- [0, 10]: density 0.1, mean 5, variance 100/12 ≈ 8.333, standard deviation ≈ 2.887.
- A fair spinner marked 0–360°: density 1/360 per degree, mean 180°, standard deviation 360/√12 ≈ 103.9°.