Uniform Distribution Calculator

Enter the interval [a, b] and a point x for the uniform distribution.

How it is calculated

For a continuous uniform distribution on the interval from a to b, let the width be w = b − a. The mean is (a + b) ÷ 2, the variance is w² ÷ 12, the density is f(x) = 1 ÷ w for a ≤ x ≤ b and 0 outside, and the cumulative probability is F(x) = (x − a) ÷ w inside the interval, 0 below a and 1 above b. Mean and variance are shown to two decimals, density and cumulative probability to four. The upper end must be larger than the lower end. The point x may lie outside [a, b], in which case the density is 0 and the cumulative probability is 0 or 1. The density is not a probability: with a narrow interval it can exceed 1.

Worked example

The interval is from a = 2 to b = 10, and the point is x = 4. Width: 10 − 2 = 8. Mean: (2 + 10) ÷ 2 = 6. Variance: 8² ÷ 12 = 64 ÷ 12 = 5.33. Density: 1 ÷ 8 = 0.125. Cumulative probability: (4 − 2) ÷ 8 = 0.25. Result: mean 6.00, variance 5.33, density 0.1250 and cumulative probability 0.2500, so there is a 25% chance that a value is 4 or less.

Try this example →

Common mistakes

  • Reading the density as a probability. The 0.1250 is a height, not a chance, and for an interval narrower than 1 it exceeds 1, which is not an error.
  • Swapping a and b or entering equal ends. The upper end b must be greater than a, otherwise no result is returned.
  • Using a standard deviation where the variance is shown. The variance is 5.33, and the standard deviation is its square root, about 2.31.
  • Expecting the density to fall off beyond the ends. It drops straight to 0 at x outside [a, b], with no gradual tail.
  • Treating the cumulative value at x as the chance of landing exactly on x. For a continuous distribution that chance is 0; the cumulative value is the chance of being at or below x.

About this calculator

The continuous uniform distribution on an interval [a, b] describes a quantity that is equally likely to take any value in that range, with no value more probable than another. Its probability density function (PDF) is flat, equal to 1/(b − a) everywhere between a and b and zero outside it, its mean is simply the midpoint (a + b)/2, and its variance is (b − a)² / 12.

The cumulative distribution function (CDF) at a point x gives the probability that the random variable is less than or equal to x, calculated as (x − a)/(b − a) within the interval. This distribution is the standard model for situations where outcomes really are equally likely across a range, such as rounding errors, the position where a random point lands on a line segment, or the output of a basic pseudo-random number generator before it's transformed into other distributions, and it's a foundational building block taught early in probability courses.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators