Compute probabilities, expected value, variance, and standard deviation for continuous and discrete uniform distributions. Visualize the probability density function (PDF), cumulative distribution function (CDF), or probability mass function (PMF) on an interactive canvas.
The uniform distribution is one of the simplest and most fundamental probability distributions in statistics. It models situations where every outcome in a given interval or finite set is equally likely. The uniform distribution comes in two flavors: continuous and discrete.
For a continuous uniform distribution on [a, b]:
f(x) = 1 / (b − a) for a ≤ x ≤ b, and 0 otherwise.
F(x) = (x − a) / (b − a) for a ≤ x ≤ b.
For a discrete uniform distribution on {a, a+1, …, b}:
P(X = k) = 1 / (b − a + 1) for k = a, a+1, …, b.
F(k) = (k − a + 1) / (b − a + 1) for k = a, a+1, …, b.
The continuous uniform distribution is defined over a continuous interval [a, b]. Any real number within the interval is equally likely. The probability density function (PDF) is a constant 1/(b−a), and the cumulative distribution function (CDF) increases linearly from 0 to 1. This distribution is commonly used in random number generation — the standard rand() function in most programming languages produces a continuous uniform distribution on [0, 1].
The discrete uniform distribution is defined over a finite set of integers {a, a+1, …, b}. Each integer in the set has equal probability 1/(b−a+1). The probability mass function (PMF) is constant, and the CDF is a step function that increases by 1/(b−a+1) at each integer. This distribution models fair dice rolls, random sampling from a finite population, and many other discrete equally-likely scenarios.
Both distributions share the same expected value: (a+b)/2. The variance differs: for continuous it is (b−a)²/12, while for discrete it is ((b−a+1)² − 1)/12. This subtle difference is important to remember when working with real-world data.
| Property | Continuous Uniform [a, b] | Discrete Uniform {a, a+1, …, b} |
|---|---|---|
| Support | a ≤ x ≤ b | k = a, a+1, …, b |
| PDF / PMF | f(x) = 1/(b−a) | P(X=k) = 1/(b−a+1) |
| CDF | F(x) = (x−a)/(b−a) | F(k) = (k−a+1)/(b−a+1) |
| Expected Value (μ) | (a+b)/2 | (a+b)/2 |
| Variance (σ²) | (b−a)²/12 | ((b−a+1)² − 1)/12 |
| Standard Deviation (σ) | (b−a)/√12 | √(((b−a+1)² − 1)/12) |
| Median | (a+b)/2 | (a+b)/2 |
| Skewness | 0 | 0 |
| Excess Kurtosis | −6/5 | −6/5 · (n²+1)/(n²−1), n = b−a+1 |
A standard six‑sided die is a classic example of a discrete uniform distribution over {1, 2, 3, 4, 5, 6}. Each face has probability 1/6. The expected value is 3.5, variance is 35/12 ≈ 2.9167, and standard deviation ≈ 1.7078. Our calculator can compute these statistics instantly. In quality control, manufacturers use uniform distribution assumptions to test whether dice are "fair" — if the observed frequencies deviate significantly from the uniform PMF, the die may be biased.
In simulation, continuous uniform distributions are used to generate random numbers that are then transformed to other distributions (e.g., inverse transform method). The calculator helps visualize how the uniform distribution serves as the foundation for more complex probability models.
The uniform distribution is foundational in statistics for several reasons. First, it is the maximum entropy distribution for a given interval — meaning it represents the state of "maximum ignorance" or "no prior information" about a parameter. This makes it a common choice as a prior distribution in Bayesian statistics (the "uniform prior"). Second, the probability integral transform states that for any continuous random variable X with CDF F, the random variable U = F(X) follows a continuous uniform distribution on [0, 1]. This property is the basis for many simulation and sampling techniques, including the inverse transform method and copula modeling.
In hypothesis testing, the p‑value is uniformly distributed under the null hypothesis, making the uniform distribution central to the interpretation of statistical significance. Understanding the uniform distribution is thus essential for anyone working with data, from students to seasoned researchers.
While the uniform distribution itself is simple, it plays a starring role in the Central Limit Theorem (CLT). The CLT states that the sum of independent, identically distributed random variables (with finite variance) tends toward a normal distribution. When the variables are uniformly distributed, the convergence is particularly easy to observe. In fact, the sum of two independent uniform(0,1) variables has a triangular distribution, and the sum of three has a distribution that is already quite close to normal. This makes the uniform distribution an excellent teaching tool for demonstrating the CLT in action.