Uniform Distribution Calculator - PDF, CDF & Mean

Calculate the probability density function, cumulative distribution function, mean, variance, and interval probability for any continuous uniform distribution.

Enter the minimum value a and maximum value b. Optionally enter a point x for the CDF, or lower and upper bounds x1/x2 for interval probability.

Uniform Distribution Calculator - PDF, CDF & Mean
Calculate the probability density function, cumulative distribution function, mean, variance, and interval probability for any continuous uniform distribution.

Optional — enter x to compute P(X ≤ x).

Optional — enter both x1 and x2 to compute P(x1 ≤ X ≤ x2).

About the uniform distribution

The continuous uniform distribution, sometimes called the rectangular distribution, describes a situation in which every value in a given interval [a, b] is equally likely to occur. It is the simplest continuous probability distribution and serves as the canonical model for phenomena where all outcomes in a range are equally probable — for example, the precise moment a bus arrives within a scheduled window, or the landing position of a spinning wheel stopped at a random time. The probability density function (PDF) of the uniform distribution is constant across the interval: f(x) = 1/(b − a) for a ≤ x ≤ b, and zero elsewhere. Because the total area under the PDF must equal one and the shape is a flat rectangle, the height of the rectangle is simply the reciprocal of the width. This makes the PDF easy to interpret: any sub-interval of the same width has the same probability, regardless of where it sits within [a, b]. The cumulative distribution function (CDF) gives the probability that a random observation falls at or below a specific value x. For the uniform distribution, F(x) = (x − a)/(b − a) for a ≤ x ≤ b. It increases linearly from zero at x = a to one at x = b, reflecting the steady accumulation of probability as x moves across the interval. To find the probability that the value falls in an interval [x1, x2], subtract: P(x1 ≤ X ≤ x2) = (x2 − x1)/(b − a), which is simply the sub-interval width divided by the total width. The mean (expected value) of the uniform distribution is the midpoint of the interval: E[X] = (a + b)/2. This makes intuitive sense — if all values are equally likely, the average value is right in the middle. The variance measures the average squared deviation from the mean and equals (b − a)² / 12. A wider interval produces a larger variance, reflecting greater uncertainty about where the outcome will fall. The uniform distribution is widely used as a starting point or benchmark in simulation, Monte Carlo methods, and random number generation. Pseudo-random number generators typically produce uniform random variables on [0, 1], which can then be transformed into other distributions using the inverse CDF method. In Bayesian statistics, the uniform prior expresses a state of complete ignorance about a parameter within a known range. In reliability engineering and scheduling, it models unknown arrival or failure times when only the range is known. Understanding the uniform distribution also provides a foundation for grasping more complex continuous distributions. Its simplicity makes it ideal for teaching the concepts of PDF, CDF, expected value, and variance before introducing the normal, exponential, or beta distributions.

Uniform distribution examples

Worked calculations using the uniform distribution formulas for common scenarios.

ParametersKey metricsApplication
a = 0, b = 1PDF = 1, Mean = 0.5, Variance = 0.0833The standard uniform distribution U(0,1), the foundation of all pseudo-random number generators and the inverse CDF transformation method.
a = 2, b = 10PDF = 0.125, Mean = 6, Variance ≈ 5.333A bus arrives uniformly between 2 and 10 minutes. The average wait is 6 minutes, and the variance is (10−2)²/12 = 64/12 ≈ 5.333.
a = 0, b = 60, x1 = 20, x2 = 40P(20 ≤ X ≤ 40) = 0.333A random minute within an hour. The probability of landing between minute 20 and minute 40 is (40−20)/60 = 1/3 ≈ 0.333.

How to use the uniform distribution calculator

  1. Enter the minimum value a in the first field and the maximum value b in the second field. Ensure b is strictly greater than a.
  2. Click Calculate to instantly see the PDF, mean, variance, and standard deviation for your distribution.
  3. Optionally enter a value x in the CDF field to compute P(X ≤ x), the probability that the random variable is at most x.
  4. Optionally enter both x1 and x2 to compute the interval probability P(x1 ≤ X ≤ x2).
  5. Click Reset to clear all fields and start a new calculation.

Uniform distribution FAQ

What is the uniform distribution used for?
The uniform distribution models situations where every outcome in a range is equally likely. Common applications include random number generation, simulation studies, Bayesian uninformative priors, and scheduling or arrival time models when only the range of possible values is known.
How do I calculate the probability for an interval?
For a uniform distribution on [a, b], the probability of a value falling in [x1, x2] is simply (x2 − x1) / (b − a). This is proportional to the width of the sub-interval relative to the total range, which reflects the flat PDF.
What is the difference between PDF and CDF for the uniform distribution?
The PDF gives the density at a single point and equals 1/(b−a) for any point in [a, b]. The CDF gives the cumulative probability up to a point x and equals (x−a)/(b−a). For continuous distributions, probabilities are only meaningful over intervals, not at individual points.
Why is variance (b−a)²/12?
The variance is derived by integrating (x − mean)² × f(x) over [a, b], where f(x) = 1/(b−a). The calculation simplifies to (b−a)²/12. A wider interval increases the variance proportionally to the square of the width, since values are spread further from the mean.
Is the uniform distribution the same as equally likely outcomes?
For continuous random variables, yes. The uniform distribution is the continuous analogue of a fair die or a random draw — every sub-interval of equal length has the same probability. However, in the continuous case, individual point probabilities are zero; only interval probabilities are non-zero.
How does the standard uniform distribution U(0,1) relate to other distributions?
The standard uniform U(0,1) is the building block for generating any continuous distribution. If U is uniform on [0,1] and F is the CDF of a target distribution, then F⁻¹(U) follows the target distribution. This inverse transform method is the basis of most random sampling algorithms.