Home»Documentation»Statistics Library User's Guide»Continuous Distributions»The Continuous Uniform Distribution

## The Continuous Uniform Distribution | Extreme Optimization Numerical Libraries for .NET Professional |

The continuous uniform distribution can be used to model [to be supplied]

The uniform distribution has two parameters: the minimum value and the maximum value. The traditional types of parameters (location, scale, shape) don't have an obvious meaning for the uniform distribution. The probability density function is:

The (continuous) uniform distribution is sometimes called the (continuous) rectangular distribution.

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:

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.

var random = new MersenneTwister(); double sample = ContinuousUniformDistribution.Sample(random, 0.0, 1.0);

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

For details of the properties and methods common to all continuous distribution classes, see the topic on continuous distributions..

Copyright Â© 2004-2023,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.