1
—
5
—
—
1
—
5
—
—
The Uniform Distribution Calculator computes the probability density function (PDF), cumulative distribution function (CDF), mean, variance, and standard deviation for the continuous uniform distribution. Also known as the rectangular distribution, the uniform distribution assigns equal probability to all values within a specified range [a, b], making it the simplest continuous probability distribution.
The continuous uniform distribution is the mathematical formalization of the concept of equal likelihood. When every value in a range is equally probable, the distribution is uniform. This arises naturally in many contexts: generating random numbers between 0 and 1, rounding errors in measurements (which are approximately uniform over half the smallest measurement unit), the position of a randomly thrown dart on a board, the arrival time of a bus if you arrive at a random moment during its schedule, and the initial phase of a random signal in communications.
The distribution is defined by two parameters: the lower bound a and the upper bound b. The PDF is constant at 1/(b-a) throughout the interval [a, b] and zero elsewhere. This flat shape gives the distribution its alternative name, the rectangular distribution. The CDF increases linearly from 0 at x = a to 1 at x = b, reflecting the equal accumulation of probability across the interval.
Despite its simplicity, the uniform distribution plays a critical role in probability theory and simulation. It is the foundation of Monte Carlo methods: random samples from virtually any distribution can be generated by transforming uniformly distributed random numbers using the inverse CDF method. The standard uniform distribution U(0,1) is the starting point for all pseudorandom number generators in computing.
In Bayesian statistics, the uniform distribution serves as a non-informative prior, expressing that all parameter values in a range are equally plausible before observing data. In order statistics, the distributions of minimum, maximum, and other rank statistics from uniform samples have elegant closed-form expressions. This calculator handles any finite interval [a, b] and properly manages edge cases where x falls outside the interval or when a equals b.
In engineering, the uniform distribution models quantization error in analog-to-digital conversion: the rounding error is approximately uniform over half the least significant bit. In cryptography, uniformly distributed random numbers are essential for generating secure keys, nonces, and initialization vectors. In simulation, Latin hypercube sampling stratifies the uniform distribution to ensure comprehensive coverage of the parameter space. The maximum entropy principle states that the uniform distribution has the highest entropy among all distributions on a bounded interval, making it the least informative (most uncertain) distribution given only range constraints.
For the continuous uniform distribution on [a, b], the PDF is:
$$f(x) = \begin{cases} \frac{1}{b - a} & \text{if } a \leq x \leq b \\ 0 & \text{otherwise} \end{cases}$$
The CDF is:
$$F(x) = \begin{cases} 0 & \text{if } x < a \\ \frac{x - a}{b - a} & \text{if } a \leq x \leq b \\ 1 & \text{if } x > b \end{cases}$$
The key statistics are:
$$E[X] = \frac{a + b}{2}, \quad \text{Var}(X) = \frac{(b - a)^2}{12}, \quad \sigma = \frac{b - a}{\sqrt{12}}$$
The mean is simply the midpoint of the interval, and the variance depends only on the range width. The standard deviation is approximately 0.2887 times the range width.
The PDF is constant (1/(b-a)) for all x in [a, b], confirming that every value is equally likely. The CDF P(X ≤ x) gives the fraction of the interval [a, b] that lies to the left of x. For example, if a = 0, b = 10, and x = 4, then CDF = 0.4, meaning 40% of the distribution lies at or below 4. If x is outside [a, b], the PDF is 0 and the CDF is either 0 (x < a) or 1 (x > b). The mean is the midpoint, and the variance increases with the square of the range width.
Inputs
Results
For U(0, 10), every value has equal density 0.1. The probability of being below 4 is 0.4 (40%). The mean is 5 and the standard deviation is about 2.89.
Inputs
Results
If a bus arrives every 15 minutes and you arrive at a random time, the probability of waiting 5 minutes or less is 33.3%. Your expected wait is 7.5 minutes.
Uniform means all values in the range are equally likely. The PDF is flat (constant), unlike distributions such as the normal (bell-shaped) or exponential (decaying). The probability of falling in any subinterval depends only on the subinterval's width, not its position. P(c < X < d) = (d-c)/(b-a) for any [c,d] within [a,b].
The standard uniform distribution is U(0, 1), with a = 0 and b = 1. It has mean 0.5, variance 1/12, and PDF = 1 for 0 ≤ x ≤ 1. All computer-generated random numbers start from U(0, 1), which is then transformed to other distributions via the inverse CDF method: if U ~ U(0,1), then X = F⁻¹(U) follows the distribution with CDF F.
Monte Carlo methods rely on generating random samples to estimate quantities. The process starts with uniform random numbers U(0,1), which are transformed into samples from any desired distribution. For example, X = -ln(1-U)/λ generates exponential samples, and the Box-Muller transform converts two uniform samples into normal samples. The uniform distribution is the universal building block.
If a = b, the range is zero and the distribution degenerates to a point mass (the random variable always equals a). The PDF is technically undefined (infinity at a single point), and the variance is zero. Our calculator uses a small positive denominator as a safeguard, but you should ensure b > a for meaningful results.
The discrete uniform assigns equal probability 1/n to each of n distinct values (like rolling a fair die). The continuous uniform assigns equal density over a continuous interval [a, b]. This calculator handles the continuous case. For the discrete case with values {1, 2, ..., n}, the mean is (n+1)/2 and the variance is (n²-1)/12.
The factor of 12 comes from integrating (x - μ)² over the uniform PDF. Specifically: Var(X) = ∫(x - (a+b)/2)² · 1/(b-a) dx from a to b. Evaluating this integral yields (b-a)²/12. Intuitively, the variance is proportional to the square of the range, and the denominator 12 normalizes for the flat distribution shape.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
Normal Distribution Calculator
Probability Distributions
Standard Normal Distribution Calculator
Probability Distributions
Poisson Distribution Calculator
Probability Distributions
Exponential Distribution Calculator
Probability Distributions
Geometric Distribution Calculator
Probability Distributions
Hypergeometric Distribution Calculator
Probability Distributions