In
probability theoryProbability theory is the branch of mathematics concerned with analysis of random phenomena. The central objects of probability theory are random variables, stochastic processes, and events: mathematical abstractions of non-deterministic events or measured quantities that may either be single...
and
statisticsStatistics is the study of the collection, organization, analysis, and interpretation of data. It deals with all aspects of this, including the planning of data collection in terms of the design of surveys and experiments....
, the
continuous uniform distribution or
rectangular distribution is a family of probability distributions such that for each member of the family, all
intervalIn mathematics, a interval is a set of real numbers with the property that any number that lies between two numbers in the set is also included in the set. For example, the set of all numbers satisfying is an interval which contains and , as well as all numbers between them...
s of the same length on the distribution's support are equally probable. The support is defined by the two parameters,
a and
b, which are its minimum and maximum values. The distribution is often abbreviated
U(
a,
b). It is the
maximum entropy probability distributionIn statistics and information theory, a maximum entropy probability distribution is a probability distribution whose entropy is at least as great as that of all other members of a specified class of distributions....
for a random variate
X under no constraint other than that it is contained in the distribution's support.
Probability density function
The
probability density functionIn probability theory, a probability density function , or density of a continuous random variable is a function that describes the relative likelihood for this random variable to occur at a given point. The probability for the random variable to fall within a particular region is given by the...
of the continuous uniform distribution is:
The values of
f(
x) at the two boundaries
a and
b are usually unimportant because they do not alter the values of the integrals of
f(
x)
dx over any interval, nor of
x f(
x)
dx or any higher moment. Sometimes they are chosen to be zero, and sometimes chosen to be 1/(
b −
a). The latter is appropriate in the context of estimation by the method of
maximum likelihoodIn statistics, maximum-likelihood estimation is a method of estimating the parameters of a statistical model. When applied to a data set and given a statistical model, maximum-likelihood estimation provides estimates for the model's parameters....
. In the context of Fourier analysis, one may take the value of
f(
a) or
f(
b) to be 1/(2(
b −
a)), since then the inverse transform of many
integral transforms of this uniform function will yield back the function itself, rather than a function which is equal "
almost everywhereIn measure theory , a property holds almost everywhere if the set of elements for which the property does not hold is a null set, that is, a set of measure zero . In cases where the measure is not complete, it is sufficient that the set is contained within a set of measure zero...
", i.e. except on a set of points with zero measure. Also, it is consistent with the
sign functionIn mathematics, the sign function is an odd mathematical function that extracts the sign of a real number. To avoid confusion with the sine function, this function is often called the signum function ....
which has no such ambiguity.
In terms of mean
μ and variance
σ2, the probability density may be written as:
Cumulative distribution function
The
cumulative distribution functionIn probability theory and statistics, the cumulative distribution function , or just distribution function, describes the probability that a real-valued random variable X with a given probability distribution will be found at a value less than or equal to x. Intuitively, it is the "area so far"...
is:
Its inverse is:
In mean and variance notation, the cumulative distribution function is:
and the inverse is:
Moment-generating function
The
moment-generating functionIn probability theory and statistics, the moment-generating function of any random variable is an alternative definition of its probability distribution. Thus, it provides the basis of an alternative route to analytical results compared with working directly with probability density functions or...
is
from which we may calculate the raw moments
m k
For a
random variableIn probability and statistics, a random variable or stochastic variable is, roughly speaking, a variable whose value results from a measurement on some type of random process. Formally, it is a function from a probability space, typically to the real numbers, which is measurable functionmeasurable...
following this distribution, the
expected valueIn probability theory, the expected value of a random variable is the weighted average of all possible values that this random variable can take on...
is then
m1 = (
a +
b)/2 and the
varianceIn probability theory and statistics, the variance is a measure of how far a set of numbers is spread out. It is one of several descriptors of a probability distribution, describing how far the numbers lie from the mean . In particular, the variance is one of the moments of a distribution...
is
m2 −
m12 = (
b −
a)
2/12.
Cumulant-generating function
For
n ≥ 2, the
nth
cumulantIn probability theory and statistics, the cumulants κn of a probability distribution are a set of quantities that provide an alternative to the moments of the distribution. The moments determine the cumulants in the sense that any two probability distributions whose moments are identical will have...
of the uniform distribution on the interval [0, 1] is
bn/n, where bn is the nth Bernoulli numberIn mathematics, the Bernoulli numbers Bn are a sequence of rational numbers with deep connections to number theory. They are closely related to the values of the Riemann zeta function at negative integers....
.
Generalization to Borel sets
This distribution can be generalized to more complicated sets than intervals. If S is a Borel setIn mathematics, a Borel set is any set in a topological space that can be formed from open sets through the operations of countable union, countable intersection, and relative complement...
of positive, finite measure, the uniform probability distribution on S can be specified by defining the pdf to be zero outside S and constantly equal to 1/K on S, where K is the Lebesgue measureIn measure theory, the Lebesgue measure, named after French mathematician Henri Lebesgue, is the standard way of assigning a measure to subsets of n-dimensional Euclidean space. For n = 1, 2, or 3, it coincides with the standard measure of length, area, or volume. In general, it is also called...
of S.
Order statistics
Let X1, ..., Xn be an i.i.d. sample from U(0,1). Let X(k) be the kth order statisticIn statistics, the kth order statistic of a statistical sample is equal to its kth-smallest value. Together with rank statistics, order statistics are among the most fundamental tools in non-parametric statistics and inference....
from this sample. Then the probability distribution of X(k) is a Beta distribution with parameters k and n − k + 1. The expected value is

This fact is useful when making Q-Q plotIn statistics, a Q-Q plot is a probability plot, which is a graphical method for comparing two probability distributions by plotting their quantiles against each other. First, the set of intervals for the quantiles are chosen...
s.
The variances are

Uniformity
The probability that a uniformly distributed random variable falls within any interval of fixed length is independent of the location of the interval itself (but it is dependent on the interval size), so long as the interval is contained in the distribution's support.
To see this, if X ~ U(a,b) and [x, x+d] is a subinterval of [a,b] with fixed d > 0, then
-

which is independent of x. This fact motivates the distribution's name.
Standard uniform
Restricting
and
, the resulting distribution U(0,1) is called a standard uniform distribution.
One interesting property of the standard uniform distribution is that if u1 has a standard uniform distribution, then so does 1-u1. This property can be used for generating antithetic variatesThe antithetic variates method is a variance reduction technique used in Monte Carlo methods. Considering that the error reduction in the simulated signal has a square root convergence , a very large number of sample paths is required to obtain an accurate result.-Underlying principle:The...
, among other things.
Related distributions
- If X has a standard uniform distribution, then by the inverse transform sampling method, Y = − ln(X) / λ has an exponential distribution
In probability theory and statistics, the exponential distribution is a family of continuous probability distributions. It describes the time between events in a Poisson process, i.e...
with (rate) parameter λ.
- Y = 1 − X1/n has a beta distribution with parameters 1 and n. (Note this implies that the standard uniform distribution is a special case of the beta distribution, with parameters 1 and 1.)
- The Irwin–Hall distribution is the sum of n i.i.d. U(0,1) distributions.
- The sum of two independent, equally distributed, uniform distributions yields a symmetric triangular distribution.
Relationship to other functions
As long as the same conventions are followed at the transition points, the probability density function may also be expressed in terms of the Heaviside step functionThe Heaviside step function, or the unit step function, usually denoted by H , is a discontinuous function whose value is zero for negative argument and one for positive argument....
:

or in terms of the rectangle function

There is no ambiguity at the transition point of the sign functionIn mathematics, the sign function is an odd mathematical function that extracts the sign of a real number. To avoid confusion with the sine function, this function is often called the signum function ....
. Using the half-maximum convention at the transition points, the uniform distribution may be expressed in terms of the sign function as:

Applications
In statisticsStatistics is the study of the collection, organization, analysis, and interpretation of data. It deals with all aspects of this, including the planning of data collection in terms of the design of surveys and experiments....
, when a p-valueIn statistical significance testing, the p-value is the probability of obtaining a test statistic at least as extreme as the one that was actually observed, assuming that the null hypothesis is true. One often "rejects the null hypothesis" when the p-value is less than the significance level α ,...
is used as a test statistic for a simple null hypothesisThe practice of science involves formulating and testing hypotheses, assertions that are capable of being proven false using a test of observed data. The null hypothesis typically corresponds to a general or default position...
, and the distribution of the test statistic is continuous, then the p-value is uniformly distributed between 0 and 1 if the null hypothesis is true.
Sampling from a uniform distribution
There are many applications in which it is useful to run simulation experiments. Many programming languageA programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
s have the ability to generate pseudo-random numbers which are effectively distributed according to the standard uniform distribution.
If u is a value sampled from the standard uniform distribution, then the value a + (b − a)u follows the uniform distribution parametrised by a and b, as described above.
Sampling from an arbitrary distribution
The uniform distribution is useful for sampling from arbitrary distributions. A general method is the inverse transform sampling method, which uses the cumulative distribution functionIn probability theory and statistics, the cumulative distribution function , or just distribution function, describes the probability that a real-valued random variable X with a given probability distribution will be found at a value less than or equal to x. Intuitively, it is the "area so far"...
(CDF) of the target random variable. This method is very useful in theoretical work. Since simulations using this method require inverting the CDF of the target variable, alternative methods have been devised for the cases where the cdf is not known in closed form. One such method is rejection samplingIn mathematics, rejection sampling is a basic pseudo-random number sampling technique used to generate observations from a distribution. It is also commonly called the acceptance-rejection method or "accept-reject algorithm"....
.
The normal distribution is an important example where the inverse transform method is not efficient. However, there is an exact method, the Box–Muller transformation, which uses the inverse transform to convert two independent uniform random variableIn probability and statistics, a random variable or stochastic variable is, roughly speaking, a variable whose value results from a measurement on some type of random process. Formally, it is a function from a probability space, typically to the real numbers, which is measurable functionmeasurable...
s into two independent normally distributed random variables.
Estimation of maximum
Given a uniform distribution on [0, N] with unknown N, the
UMVU estimator for the maximum is given by

where m is the sample maximum and k is the sample sizeSample size determination is the act of choosing the number of observations to include in a statistical sample. The sample size is an important feature of any empirical study in which the goal is to make inferences about a population from a sample...
, sampling without replacement (though this distinction almost surely makes no difference for a continuous distribution). This follows for the same reasons as estimation for the discrete distribution, and can be seen as a very simple case of maximum spacing estimationIn statistics, maximum spacing estimation , or maximum product of spacing estimation , is a method for estimating the parameters of a univariate statistical model...
. This problem is commonly known as the German tank problemIn the statistical theory of estimation, estimating the maximum of a uniform distribution is a common illustration of differences between estimation methods...
, due to application of maximum estimation to estimates of German tank production during World War IIWorld War II, or the Second World War , was a global conflict lasting from 1939 to 1945, involving most of the world's nations—including all of the great powers—eventually forming two opposing military alliances: the Allies and the Axis...
.
Estimation of midpoint
The midpoint of the distribution (a + b) / 2 is both the mean and the median of the uniform distribution. Although both the sample mean and the sample median are unbiased estimators of the midpoint, neither is as efficientIn statistics, an efficient estimator is an estimator that estimates the quantity of interest in some “best possible” manner. The notion of “best possible” relies upon the choice of a particular loss function — the function which quantifies the relative degree of undesirability of estimation errors...
as the sample mid-range, i.e. the arithmetic mean of the sample maximum and the sample minimum, which is the UMVU estimator of the midpoint (and also the maximum likelihood estimate).
See also
- Beta distribution
- Box–Muller transform
- Probability plot
In statistics, a P-P plot is a probability plot for assessing how closely two data sets agree, which plots the two cumulative distribution functions against each other....
- Q-Q plot
In statistics, a Q-Q plot is a probability plot, which is a graphical method for comparing two probability distributions by plotting their quantiles against each other. First, the set of intervals for the quantiles are chosen...
- Random number
Random number may refer to:* A number generated for or part of a set exhibiting statistical randomness.* A random sequence obtained from a stochastic process.* An algorithmically random sequence in algorithmic information theory....
- Rectangular function
- Uniform distribution (discrete)
External links