# Uniform Distribution Calculator

URL: https://speedycalculator.com/calculators/statistics/uniform-distribution/
Last updated: 2026-10-30

> The continuous uniform distribution calculator works with U(a, b), where every value between a and b is equally likely: it gives the density, cumulative and tail probabilities, the probability of any range, quantiles and random values, plus the mean, median, variance and standard deviation.

## Inputs

- Lower bound a
- Upper bound b
- What to calculate
- Value x (x₁ for a range)
- Upper value x₂
- Cumulative probability p (%)
- How many random values

## Results

- Result
- Uniform density with the requested area shaded
- Probability density f(x)
- P(X ≤ x) – cumulative (CDF)
- P(X > x) – survival
- P(x₁ ≤ X ≤ x₂)
- P(X < x₁ or X > x₂)
- Quantile x
- Random sample
- Height of the density 1/(b − a)
- Mean (expected value)
- Median
- Mode (peak of the density)
- Variance
- Standard deviation
- Skewness
- Excess kurtosis

## Formula

```
f(x) = 1/(b − a) for a ≤ x ≤ b · P(X ≤ x) = (x − a)/(b − a) · mean = median = (a + b)/2 · variance = (b − a)²/12 · quantile = a + p(b − a)
```

## Explanation

The continuous uniform distribution is the simplest distribution there is: a random value is equally likely to land anywhere between a lower bound a and an upper bound b, and never outside. Its density is a flat rectangle of height 1/(b − a), so every probability is just a length divided by the total length.

It models situations with no reason to prefer one value over another: the arrival time of a bus that runs every 15 minutes when you turn up at random, rounding errors, the position of a break along a rod, or the angle of a spun pointer. The standard uniform U(0, 1) is the building block of computer simulation – random numbers from any other distribution are made by feeding U(0, 1) values through an inverse CDF.

This calculator gives P(X ≤ x), P(X > x), the probability between or outside two values, quantiles, random values and the summary measures. Because the density is flat there is no single mode – every value in [a, b] is equally likely – and the distribution is symmetric with skewness 0 and excess kurtosis −1.2.

### How to use the Uniform Distribution Calculator

- **Lower bound a**
- **Upper bound b**
- **What to calculate**
- **Value x (x₁ for a range)**
- **Upper value x₂**
- **Cumulative probability p**
- **How many random values**

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

Probabilities are lengths: the overlap of the requested interval with [a, b] divided by b − a. Quantiles are a + p(b − a), which also produces the random sample. Choose what to calculate: a cumulative probability, an upper tail, the probability between or outside two values, a quantile (inverse CDF) or a random sample generated by inverse-transform sampling. The chart shades exactly the area you asked for.

### Worked example

For U(0, 10): the density is 1/10 = 0.1, P(X ≤ 3) = 3/10 = 30%, P(3 ≤ X ≤ 7) = 40% and P(X < 3 or X > 7) = 60%. The mean and median are 5, the variance 100/12 = 8.333 and the standard deviation 2.887. The 25th percentile is 0 + 0.25 × 10 = 2.5.

### When to use it

Use the uniform distribution when only the range of a quantity is known and no value is more likely than another – random arrival within a timetable gap, rounding errors of ±0.5 units, or a first rough model in a simulation. If values near the middle are more likely, a triangular, beta or normal model fits better.

## Worked example

Inputs — Lower bound a: 0; Upper bound b: 10; What to calculate: P(x₁ ≤ X ≤ x₂) – probability between two values; Value x (x₁ for a range): 3; Upper value x₂: 7.

Results — **Result = P(3 ≤ X ≤ 7) = 0.4 (40%)**; Probability density f(x) = 0.1; P(X ≤ x) – cumulative (CDF) = 30 %; P(X > x) – survival = 70 %; P(x₁ ≤ X ≤ x₂) = 40 %; P(X < x₁ or X > x₂) = 60 %.

## Key terms

- **Continuous uniform distribution**: A distribution with constant density on [a, b] and zero elsewhere.
- **Standard uniform**: U(0, 1), the basis of random-number generation.
- **Inverse-transform sampling**: Turning a U(0, 1) value u into a value of another distribution with its quantile function.

## FAQ

**What is the probability of a range in a uniform distribution?**
Its length divided by b − a. For U(0, 10), P(3 ≤ X ≤ 7) = 4/10 = 40%.

**What are the mean and variance of U(a, b)?**
Mean (a + b)/2 and variance (b − a)²/12. For U(0, 10): 5 and 8.333 (SD 2.887).

**What is the mode?**
There is none – every value between a and b has the same density, so the calculator leaves the mode blank.

**What is the standard uniform distribution?**
U(0, 1), with mean 0.5 and variance 1/12. Random-number generators produce it.

**If a bus comes every 15 minutes, what is the chance of waiting under 5 minutes?**
With a wait uniform on 0 to 15 minutes, 5/15 = 33.3%.

**What is the difference from the discrete uniform distribution?**
The discrete version has a finite list of equally likely values (a fair die: 1 to 6); the continuous one allows any real number in the interval.


## Sources

- [NIST/SEMATECH e-Handbook – Gallery of distributions](https://www.itl.nist.gov/div898/handbook/eda/section3/eda366.htm)
- [OpenStax – Introductory Statistics 2e](https://openstax.org/details/books/introductory-statistics-2e)
- [Penn State STAT 414 – Introduction to Probability Theory](https://online.stat.psu.edu/stat414/)
