# UniformDistribution

UniformDistribution[{min,max}]

represents a continuous uniform statistical distribution giving values between min and max.

represents a uniform distribution giving values between 0 and 1.

UniformDistribution[{{xmin,xmax},{ymin,ymax},}]

represents a multivariate uniform distribution over the region {{xmin,xmax},{ymin,ymax},}.

represents a multivariate uniform distribution over the standard n dimensional unit hypercube.

# Background & Context

• UniformDistribution[{a,b}] represents a statistical distribution (sometimes also known as the rectangular distribution) in which a random variate is equally likely to take any value in the interval . Consequently, the uniform distribution is parametrized entirely by the endpoints of its domain and its probability density function is constant on the interval . The standard uniform distribution, which may be returned using , is taken on the interval . The uniform distribution also generalizes to multiple variates, each of which is equally likely on some domain.
• The inverse transform method, which allows sampling from an arbitrary distribution by applying the inverse of the cumulative distribution function of a target random variable to variates selected from a uniform distribution, is an important application of this distribution. Another important property is that when testing a null hypothesis using a p-value with continuous distribution as a test statistic, the p-value has a standard uniform distribution if the null hypothesis is true.
• RandomVariate can be used to give one or more machine- or arbitrary-precision (the latter via the WorkingPrecision option) pseudorandom variates from a uniform distribution. Distributed[x,UniformDistribution[{a,b}]], written more concisely as xUniformDistribution[{a,b}], can be used to assert that a random variable x is distributed according to a uniform distribution. Such an assertion can then be used in functions such as Probability, NProbability, Expectation, and NExpectation.
• The probability density and cumulative distribution functions may be given using PDF[UniformDistribution[{a,b}],x] and CDF[UniformDistribution[{a,b}],x]. The mean, median, variance, raw moments, and central moments may be computed using Mean, Median, Variance, Moment, and CentralMoment, respectively.
• DistributionFitTest can be used to test if a given dataset is consistent with a uniform distribution, EstimatedDistribution to estimate a uniform parametric distribution from given data, and FindDistributionParameters to fit data to a uniform distribution. ProbabilityPlot can be used to generate a plot of the CDF of given data against the CDF of a symbolic uniform distribution and QuantilePlot to generate a plot of the quantiles of given data against the quantiles of a symbolic uniform distribution.
• TransformedDistribution can be used to represent a transformed uniform distribution, CensoredDistribution to represent the distribution of values censored between upper and lower values, and TruncatedDistribution to represent the distribution of values truncated between upper and lower values. CopulaDistribution can be used to build higher-dimensional distributions that contain a uniform distribution and ProductDistribution can be used to compute a joint distribution with independent component distributions involving uniform distributions.
• The uniform distribution is related to a number of other distributions. For example, is a special case of BetaDistribution and PowerDistribution in the sense that (modulo inclusion of the endpoints and ), PDF[UniformDistribution[],x] is equal to both PDF[BetaDistribution[1,1],x] and PDF[PowerDistribution[1,1],x]. The discrete uniform distribution is given by DiscreteUniformDistribution, and UniformSumDistribution generalizes the uniform distribution to the distribution of a sum of random uniform variates. The sum of two independent and equally distributed uniform distributions yields a symmetric TriangularDistribution. If has a standard uniform distribution, then has a BetaDistribution with parameters and 1. The probability distribution of the -order statistic for an independent and identically distributed sample from a standard uniform distribution (which can be found using OrderDistribution[{UniformDistribution[],n},k]) is given by BetaDistribution[k,1-k+n], with the corresponding expected value of (which may be computed using Expectation[x,xBetaDistribution[k,1-k+n]]) given by . Other closely related distributions include VonMisesDistribution, LogisticDistribution, WeibullDistribution, LaplaceDistribution, BatesDistribution, and ChiSquareDistribution.

# Examples

open allclose all

## Basic Examples(8)

Probability density function of univariate uniform distribution:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Cumulative distribution function of univariate uniform distribution:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Mean and variance of univariate uniform distribution:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Median of univariate uniform distribution:

 In[1]:=
 Out[1]=

Probability density function in two dimensions:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Cumulative distribution function in two dimensions:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Mean and variance in two dimensions:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Covariance:

 In[1]:=
 Out[1]//MatrixForm=