Mathwords logoMathwords

Uniform Distribution — Definition, Formula & Examples

A uniform distribution is a probability distribution where every outcome in a given range is equally likely. For example, rolling a fair die gives each face (1 through 6) the same probability of 1/6.

A continuous uniform distribution on the interval [a,b][a, b] has a constant probability density function f(x)=1baf(x) = \frac{1}{b - a} for axba \le x \le b and f(x)=0f(x) = 0 otherwise. Its mean is a+b2\frac{a + b}{2} and its variance is (ba)212\frac{(b - a)^2}{12}. A discrete uniform distribution assigns equal probability 1n\frac{1}{n} to each of nn distinct outcomes.

Key Formula

f(x) = \frac{1}{b - a}, \quad a \le x \le b$$ $$P(c \le X \le d) = \frac{d - c}{b - a}$$ $$\mu = \frac{a + b}{2}, \quad \sigma^2 = \frac{(b - a)^2}{12}
Where:
  • aa = Minimum value of the distribution
  • bb = Maximum value of the distribution
  • f(x)f(x) = Probability density function (height of the rectangle)
  • c,dc, d = Endpoints of the sub-interval you want the probability for
  • μ\mu = Mean (expected value)
  • σ2\sigma^2 = Variance

How It Works

You use a uniform distribution whenever no outcome in a range is favored over another. For the continuous case, the probability of landing in any sub-interval depends only on that sub-interval's width relative to the total range. To find P(cXd)P(c \le X \le d), you calculate dcba\frac{d - c}{b - a}. The density curve is a flat horizontal line, forming a rectangle over [a,b][a, b], which is why this is sometimes called the rectangular distribution.

Worked Example

Problem: A bus arrives at a stop every 30 minutes. You arrive at a random time. What is the probability you wait between 5 and 15 minutes? Also find the mean and standard deviation of your wait time.
Identify the distribution: Your wait time X follows a continuous uniform distribution on [0, 30] since every arrival moment in the 30-minute window is equally likely.
XUniform(0,30)X \sim \text{Uniform}(0,\, 30)
Find the probability: Use the formula for the probability of a sub-interval with c = 5 and d = 15.
P(5X15)=155300=1030=13P(5 \le X \le 15) = \frac{15 - 5}{30 - 0} = \frac{10}{30} = \frac{1}{3}
Find the mean: The mean wait time is the midpoint of the interval.
μ=0+302=15 minutes\mu = \frac{0 + 30}{2} = 15 \text{ minutes}
Find the standard deviation: First compute the variance, then take the square root.
σ2=(300)212=90012=75,σ=758.66 minutes\sigma^2 = \frac{(30 - 0)^2}{12} = \frac{900}{12} = 75, \quad \sigma = \sqrt{75} \approx 8.66 \text{ minutes}
Answer: The probability of waiting between 5 and 15 minutes is 130.333\frac{1}{3} \approx 0.333. The mean wait is 15 minutes with a standard deviation of about 8.66 minutes.

Another Example

Problem: A random number generator produces integers from 1 to 8, each equally likely. What is the probability of getting a number greater than 5?
Identify outcomes: This is a discrete uniform distribution with n = 8 outcomes. Each outcome has probability 1/8.
P(X=k)=18 for k=1,2,,8P(X = k) = \frac{1}{8} \text{ for } k = 1, 2, \ldots, 8
Count favorable outcomes: The values greater than 5 are 6, 7, and 8 — that is 3 outcomes.
P(X>5)=38P(X > 5) = \frac{3}{8}
Answer: The probability of getting a number greater than 5 is 38=0.375\frac{3}{8} = 0.375.

Visualization

Why It Matters

The uniform distribution appears throughout AP Statistics and introductory college probability courses as a foundational model for randomness. It is the basis for random number generators used in simulations, games, and cryptography. Understanding it also builds intuition for comparing other distributions — many are defined by how they deviate from the uniform case.

Common Mistakes

Mistake: Using the probability formula outside the interval [a, b]
Correction: The density is zero outside [a, b]. If your sub-interval extends beyond the range, clip it to [a, b] before calculating. For instance, with Uniform(0, 30), P(X > 25) = (30 − 25)/(30 − 0), not (some larger value − 25)/(30).
Mistake: Confusing the density value with a probability
Correction: For a continuous uniform distribution, f(x) = 1/(b − a) is a density, not a probability. The probability of any single exact value is 0. You must integrate (multiply density by interval width) to get an actual probability.