Continuous Uniform Distribution

The continuous uniform distribution, also known as the rectangular distribution, is a probability distribution that has constant probability over a given interval. It is defined by two parameters: the minimum value and the maximum value.

Definition

The continuous uniform distribution is defined over the interval [a,b] where a is the minimum value and b is the maximum value. The probability density function (PDF) is given by:

f(x)=1baforaxb

The cumulative distribution function (CDF) is given by:

F(x)={0for x<axabafor axb1for x>b

The parameters must satisfy the condition a<b.

Applications

  • Random number generation uses the uniform distribution as a basis for generating other distributions.

  • Quantization noise in digital signal processing is often modeled as uniformly distributed.

  • Game theory uses it to model random strategies when all options are equally viable.

  • Statistical testing employs it for generating null distributions.

Properties

Statistical Properties
PropertyValue
Meana+b2
Variance(ba)212
Skewness0
Excess Kurtosis65
Mediana+b2
ModeAny value in [a,b]
Entropyln(ba)

Notable properties include:

  • The characteristic function is ϕ(t)=eitbeitait(ba).

  • The distribution has constant probability density over its support.

  • The distribution is symmetric about its mean.

Relationships to Other Distributions

  • The uniform distribution is a special case of the beta distribution with parameters α=β=1.

  • It is the maximum entropy distribution for a bounded interval with no other constraints.

  • The sum of uniform random variables approaches a normal distribution by the central limit theorem.

The ContinuousUniformDistribution class

The uniform distribution is implemented by the ContinuousUniformDistribution class. It has three constructors. The first constructor takes no arguments. It creates the standard uniform distribution over the interval [0,1]. The second constructor takes one argument: the maximum value. The minimum value defaults to 0. Finally, the third constructor takes two arguments: the minimum and the maximum value.

The following constructs the uniform distribution over the interval [0,1] using each of the constructors:

C#
var uniform1 = new ContinuousUniformDistribution();
var uniform2 = new ContinuousUniformDistribution(1.0);
var uniform3 = new ContinuousUniformDistribution(0.0, 1.0);

The ContinuousUniformDistribution class has two specific properties, LowerBound and UpperBound, which return the lower and upper limits of the distribution.

ContinuousUniformDistribution has one static (Shared in Visual Basic) method, Sample, which generates a random sample using a user-supplied uniform random number generator. The second and third parameters are the minimum and maximum values of the distribution.

C#
var random = new Pcg32();
double sample = ContinuousUniformDistribution.Sample(random, 0.0, 1.0);

The above example uses the Pcg32 class to generate uniform random numbers.

References

For more information on the uniform distribution, refer to the following sources:

  • Johnson, N. L., Kotz, S., & Balakrishnan, N. (1994). "Continuous Univariate Distributions, Volume 2", Chapter 26. Wiley Series in Probability and Statistics.

  • Forbes, C., Evans, M., Hastings, N., & Peacock, B. (2011). "Statistical Distributions", Chapter 41. Wiley Series in Probability and Statistics.

  • Evans, M., Hastings, N., & Peacock, B. (2000). Statistical Distributions. Wiley-Interscience.

See Also