Uniform Distribution Calculator

Calculate mean, variance, PDF, and CDF of a continuous uniform distribution on [a, b].
Enter any x to find the probability P(X ≤ x) instantly.

Uniform Distribution Result

The continuous uniform distribution U(a, b) describes a random variable that is equally likely to take any value between a and b, and impossible outside that range.

PDF: f(x) = 1/(b-a) for a ≤ x ≤ b, and 0 everywhere else

CDF: F(x) = P(X ≤ x) = (x-a)/(b-a) for a ≤ x ≤ b

Mean: μ = (a+b)/2

Variance: σ² = (b-a)²/12

Standard deviation: σ = (b-a)/√12 = (b-a)/(2√3)

Median: (a+b)/2 (same as the mean — the distribution is symmetric)

The PDF is a flat horizontal line at height 1/(b-a). The CDF is a straight line from 0 at x=a to 1 at x=b.

When to use it

The uniform distribution applies when all outcomes in a range are equally likely and you have no reason to prefer any particular value. A random number generator that produces values from 0 to 1 follows U(0,1). The classic “roll a fair die” situation is a discrete uniform distribution; rolling a spinner on a continuous scale is continuous uniform.

It is also the prior in Bayesian inference when you have no prior information about a parameter — a “flat prior” says you find all values equally plausible before seeing data.

Key interval probability

P(x₁ < X < x₂) = (x₂ - x₁)/(b - a) for any x₁, x₂ within [a, b]. The fraction of the total interval determines the probability. If the interval is (2, 5) and the range is (0, 10), there is a 30% chance X falls in that interval.

The standard uniform U(0,1) is a special case used constantly in simulation and random number generation.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.