A uniform distribution is a probability distribution that spreads probability evenly over a specified set. In the discrete case, every outcome in a finite set has the same probability. In the continuous case, equal-length subintervals within a bounded interval have equal probabilities. The term “rectangular distribution” refers to the rectangular graph of the continuous distribution’s density. Uniform distributions provide basic models for random selection and building blocks for simulation. (randomservices.org)
Discrete uniform distribution
A random variable is uniformly distributed on a finite set when its probability mass function satisfies
Consequently, an event containing of these outcomes has probability . The outcomes need not be numbers: a uniform distribution can describe selecting a card, a name, or another labeled object. A fair six-sided die is a numerical example, with each face having probability . (randomservices.org)
For consecutive integers , let . The expected value and variance are
For an arbitrary numerical set, the expectation is its arithmetic average, and the variance is the average squared deviation from that value. Equal probability does not require equal numerical spacing between outcomes. (randomservices.org)
Continuous uniform distribution
For finite real numbers , the notation denotes the continuous uniform distribution on the interval from to . Its probability density function is
The density integrates to one. For ,
Thus, probability depends on interval length rather than location. For example, a uniform value between 2 and 10 falls between 3 and 5 with probability . (ocw.mit.edu)
Unlike discrete outcomes, individual points have probability zero: . Uniformity therefore means equal density, not positive equal probability for every real number. Including or excluding either endpoint leaves the probability distribution unchanged; changing a density at finitely many points does not affect its integral. (live.ocw.mit.edu)
The cumulative distribution function is
Its quantile function is for , so quantiles are equally spaced. The special case is called the standard uniform distribution. (randomservices.org)
Moments and transformations
The continuous uniform distribution is symmetric about its midpoint, which is both its mean and median. Its principal moments are
Its standard deviation is therefore . Increasing the interval’s width increases dispersion, while shifting both endpoints by the same amount changes location without changing variance. (itl.nist.gov)
If , then . Conversely, is standard uniform when . These affine transformations preserve uniformity. Nonlinear transformations generally do not: if , direct calculation gives for , rather than the linear cumulative distribution of a uniform variable. (randomservices.org)
Simulation and probability transformations
Uniform random values are fundamental inputs for generating samples from other distributions. In inverse transform sampling, a standard uniform variable is transformed using a target distribution’s generalized quantile function:
The resulting has cumulative distribution function . The generalized inverse accommodates discrete distributions as well as continuous ones. (ocw.mit.edu)
The probability integral transform works in the opposite direction: if has a continuous cumulative distribution function , then is standard uniform. For an invertible , this follows from . The continuity requirement matters; applying a discrete cumulative distribution function does not ordinarily produce a continuous uniform variable. (ocw.mit.edu)
Generalization and reference measures
In measure theory, uniformity is defined relative to a reference measure . For a measurable set with ,
Counting measure gives discrete uniform distributions, while Lebesgue measure gives uniform distributions over intervals and regions in Euclidean space. Equal-volume regions then have equal probability. Conditioning on a measurable subset of positive measure produces a uniform distribution on that subset. (randomservices.org)
The finite-measure condition excludes constant-density probability distributions over the entire real line. Likewise, no uniform probability distribution exists on a countably infinite set: a common positive point probability would sum to infinity, while a common zero probability would sum to zero. Uniformity is therefore a property of a specified domain and reference measure, not an unrestricted synonym for randomness. (randomservices.org)
Statistical estimation
For independent observations from , with both endpoints unknown and at least two distinct observations, maximum likelihood estimation gives
The likelihood is proportional to when the interval contains every observation, and is zero otherwise. It is maximized by the narrowest interval containing the sample. (itl.nist.gov)
These endpoint estimates are biased inward. For a sample of size ,
These formulas follow by rescaling the expected minimum and maximum of standard uniform observations. The expected gap between each estimate and its corresponding endpoint decreases as sample size increases. (itl.nist.gov)