Uniform Distribution Calculator

This uniform distribution calculator finds probabilities, the mean and the variance for a continuous uniform distribution on the interval [a, b].

Checks on your data

  • Values outside [a, b] have probability 0, so a range that extends beyond the interval is clipped to it.

Results

P(5 ≤ X ≤ 12)
0.35
35 %
Mean (a + b)/2
10
Median
10
Variance (b − a)²/12
33.333333
Standard deviation
5.7735027
Density 1/(b − a)
0.05
Interval length b − a
20
Skewness / excess kurtosis
0 / −1.2
Uniform(0, 20) density: shaded = P(5 ≤ X ≤ 12)
05101520x
Show step-by-step solution
  1. Density f(x) = 1 ÷ (b − a) = 1 ÷ (20 − 0) = 0.05 for a ≤ x ≤ b.
  2. P = (x₂ − x₁) ÷ (b − a), clipped to [a, b] = 0.35.
  3. Mean = (a + b) ÷ 2 = 10; variance = (b − a)² ÷ 12 = 33.333333.
Density1/(b − a)
Mean(a + b)/2
Variance(b − a)²/12
ShapeFlat

What Is Uniform Distribution?

A continuous uniform distribution assigns the same density 1/(b − a) to every value between a and b. Probabilities are therefore proportional to length: P(x₁ ≤ X ≤ x₂) = (x₂ − x₁) ÷ (b − a).

Enter the limits and the value or range you need. The calculator returns the probability, the mean (a + b)/2, the variance (b − a)²/12, the standard deviation and the density, and draws the flat density with your region shaded.

Below you will find the formulas, variables, a worked bus-wait example and answers to common questions about continuous versus discrete uniform distributions.

How to Use the Uniform Distribution Calculator

  1. Enter the lower and upper limits a and b.
  2. Choose ≤, > or between.
  3. Enter x (and x₂).
  4. Read the probability, mean and variance.

Uniform Distribution Formula

Density

f(x)=1b−a,a≤x≤bf(x)=\frac{1}{b-a},\quad a\le x\le b

Probability of a range

P(x1≤X≤x2)=x2−x1b−aP(x_1\le X\le x_2)=\frac{x_2-x_1}{b-a}

Mean and variance

E[X]=a+b2,Var(X)=(b−a)212E[X]=\frac{a+b}{2},\quad Var(X)=\frac{(b-a)^2}{12}

Uniform Distribution Variables Explained

SymbolMeaningNotes
aLower limit
bUpper limitmust exceed a
f(x)Density1 ÷ (b − a)
E[X]Mean(a + b) ÷ 2

Uniform Distribution Worked Example

A bus arrives at a random time within a 20-minute window, so X is uniform on [0, 20]. The chance you wait between 5 and 12 minutes is (12 − 5) ÷ 20 = 0.35. The mean wait is 10 minutes and the variance is 20² ÷ 12 = 33.33, a standard deviation of 5.77 minutes.

With the example values loaded in the calculator above, the steps are:

  1. Density f(x) = 1 ÷ (b − a) = 1 ÷ (20 − 0) = 0.05 for a ≤ x ≤ b.
  2. P = (x₂ − x₁) ÷ (b − a), clipped to [a, b] = 0.35.
  3. Mean = (a + b) ÷ 2 = 10; variance = (b − a)² ÷ 12 = 33.333333.

Result: P(5 ≤ X ≤ 12) = 0.35; Mean (a + b)/2 = 10.

How to Read a Uniform Probability

In a uniform distribution every value between a and b is equally likely, so probability is just the share of the interval. If a bus arrives at a random time in a 20-minute window, the chance you wait between 5 and 12 minutes is (12 − 5) ÷ 20 = 0.35.

The mean is the midpoint, (a + b) ÷ 2 = 10 minutes. The variance is (b − a)² ÷ 12 = 33.3, giving a standard deviation near 5.77 minutes. The density is flat at 1 ÷ (b − a), which is 0.05 per minute here.

Where Uniform Distribution Is Used

Waiting times

Find the chance a wait falls in a given range when arrival is random within a window.

Random numbers

Check results for random numbers drawn between two limits.

Rounding error

Model rounding error as uniform over one unit.

Teaching

See the flat density and the formulas for mean and variance.

Common Uniform Distribution Mistakes to Avoid

  • The model is continuous. The probability of any single exact value is 0.
  • Probability is the length of your range divided by b − a. Clip your range to [a, b] first.
  • The mean and median are both the midpoint, which is a quick check.
  • Use a discrete uniform for whole-number outcomes such as a die roll.

Uniform Distribution Terms and Definitions

Uniform distribution
A distribution where every value in an interval is equally likely.
Density
The constant height 1/(b − a) of the flat curve.

Uniform Distribution FAQs

How do you find probability for a uniform distribution?

Divide the length of your interval by the length of the whole range: P(x₁ ≤ X ≤ x₂) = (x₂ − x₁) ÷ (b − a). For a range of 5 to 12 within [0, 20] this is 7 ÷ 20 = 0.35.

What is the mean of a uniform distribution?

It is (a + b) ÷ 2, the midpoint of the interval. For [0, 20] the mean is 10.

What is the variance of a uniform distribution?

It is (b − a)² ÷ 12. For [0, 20] that is 400 ÷ 12 ≈ 33.33, so the standard deviation is about 5.77.

What is the difference between continuous and discrete uniform?

A continuous uniform allows any real number in the interval, with a flat density. A discrete uniform has a finite set of equally likely values, such as the faces of a die, each with probability 1 ÷ n.

Related calculators

Last updated 2026-11-09. See our disclaimer.