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);
Dim uniform1 = New ContinuousUniformDistribution()
Dim uniform2 = New ContinuousUniformDistribution(1.0)
Dim uniform3 = New ContinuousUniformDistribution(0.0, 1.0)
No code example is currently available or this language may not be supported.
let uniform1 = ContinuousUniformDistribution()
let uniform2 = ContinuousUniformDistribution(1.0)
let uniform3 = 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);
Dim random = New MersenneTwister()
Dim sample = ContinuousUniformDistribution.Sample(random, 0.0, 1.0)
No code example is currently available or this language may not be supported.
let random = MersenneTwister()
let 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..