Uniform Distribution Calculator

Enter the interval [a, b] and a value x to compute the continuous uniform PDF density, the CDF probability P(X ≤ x), and the distribution's mean, variance, and standard deviation.

Quick Facts

Method
Continuous uniform distribution on [a, b]
PDF = 1/(b−a); CDF = (x−a)/(b−a); mean = (a+b)/2; variance = (b−a)²/12.

Your Results

Calculated
P(X ≤ x) — CDF
-
Probability at or below x
Density f(x) — PDF
-
Height of the distribution at x
Mean
-
Midpoint (a + b)/2
Std. deviation
-
(b − a)/√12

Ready

Enter the interval and a value, then calculate.

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°.

Frequently Asked Questions

What is the PDF of a continuous uniform distribution?
On the interval [a, b], the density is f(x) = 1/(b − a) for every x between a and b and 0 elsewhere. It is constant, so the graph is a flat rectangle of height 1/(b − a). On [0, 10] the density is 1/10 = 0.1 at any point inside the interval.
How do I find P(X ≤ x)?
Use the CDF F(x) = (x − a)/(b − a) for a ≤ x ≤ b; it is 0 below a and 1 above b. On [0, 10], P(X ≤ 3) = 3/10 = 0.3. For a range, subtract: P(4 ≤ X ≤ 7) = (7 − 4)/10 = 0.3.
What are the mean and standard deviation?
The mean is the midpoint (a + b)/2. The variance is (b − a)²/12 and the standard deviation is (b − a)/√12 ≈ 0.2887(b − a). On [0, 10] the mean is 5, the variance is 100/12 ≈ 8.333, and the standard deviation is 10/√12 ≈ 2.887.
Can the density be greater than 1?
Yes. A density is not a probability — only the area under it must equal 1. When the interval is narrower than one unit, the height exceeds 1; for example on [0, 0.25] the density is 1/0.25 = 4. Probabilities themselves always stay between 0 and 1.
What is the difference between the continuous and discrete uniform distribution?
The continuous version covers every real number in [a, b] and uses a density. The discrete uniform distribution covers a finite set of n equally likely outcomes (like a fair die's 1–6), where each outcome has probability 1/n. This calculator models the continuous case.