## Types in MathNet.Numerics.Distributions

Type DiscreteUniform

Namespace MathNet.Numerics.Distributions

Interfaces IDiscreteDistribution

Discrete Univariate Uniform distribution. The discrete uniform distribution is a distribution over integers. The distribution is parameterized by a lower and upper bound (both inclusive)..

### Public Constructors

#### DiscreteUniform(int lower, int upper, Random randomSource)

Initializes a new instance of the DiscreteUniform class.
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

###### `Random` randomSource

The random number generator which is used to draw random samples.

#### DiscreteUniform(int lower, int upper)

Initializes a new instance of the DiscreteUniform class.
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

### Public Static Functions

#### doubleCDF(int lower, int upper, double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

###### `double` x

The location at which to compute the cumulative distribution function.

##### Return
###### `double`

the cumulative distribution at location x.

#### boolIsValidParameterSet(int lower, int upper)

Tests whether the provided values are valid parameters for this distribution.
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

#### doublePMF(int lower, int upper, int k)

Computes the probability mass (PMF) at k, i.e. P(X = k).
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

###### `int` k

The location in the domain where we want to evaluate the probability mass function.

##### Return
###### `double`

the probability mass at location k.

#### doublePMFLn(int lower, int upper, int k)

Computes the log probability mass (lnPMF) at k, i.e. ln(P(X = k)).
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

###### `int` k

The location in the domain where we want to evaluate the log probability mass function.

##### Return
###### `double`

the log probability mass at location k.

#### intSample(Random rnd, int lower, int upper)

Samples a uniformly distributed random variable.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

##### Return
###### `int`

A sample from the discrete uniform distribution.

#### intSample(int lower, int upper)

Samples a uniformly distributed random variable.
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

##### Return
###### `int`

A sample from the discrete uniform distribution.

#### voidSamples(Int32[] values, int lower, int upper)

Fills an array with samples generated from the distribution.
##### Parameters
###### `Int32[]` values

The array to fill with the samples.

###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

##### Return
###### `void`

a sequence of samples from the discrete uniform distribution.

#### voidSamples(Random rnd, Int32[] values, int lower, int upper)

Fills an array with samples generated from the distribution.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `Int32[]` values

The array to fill with the samples.

###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

##### Return
###### `void`

a sequence of samples from the discrete uniform distribution.

#### IEnumerable<int>Samples(Random rnd, int lower, int upper)

Samples a sequence of uniformly distributed random variables.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

##### Return
###### `IEnumerable<int>`

a sequence of samples from the discrete uniform distribution.

#### IEnumerable<int>Samples(int lower, int upper)

Samples a sequence of uniformly distributed random variables.
##### Parameters
###### `int` lower

Lower bound, inclusive. Range: lower ≤ upper.

###### `int` upper

Upper bound, inclusive. Range: lower ≤ upper.

##### Return
###### `IEnumerable<int>`

a sequence of samples from the discrete uniform distribution.

### Public Methods

#### doubleCumulativeDistribution(double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
##### Parameters
###### `double` x

The location at which to compute the cumulative distribution function.

##### Return
###### `double`

the cumulative distribution at location x.

#### doubleProbability(int k)

Computes the probability mass (PMF) at k, i.e. P(X = k).
##### Parameters
###### `int` k

The location in the domain where we want to evaluate the probability mass function.

##### Return
###### `double`

the probability mass at location k.

#### doubleProbabilityLn(int k)

Computes the log probability mass (lnPMF) at k, i.e. ln(P(X = k)).
##### Parameters
###### `int` k

The location in the domain where we want to evaluate the log probability mass function.

##### Return
###### `double`

the log probability mass at location k.

#### intSample()

Draws a random sample from the distribution.
##### Return
###### `int`

a sample from the distribution.

#### IEnumerable<int>Samples()

Samples an array of uniformly distributed random variables.
##### Return
###### `IEnumerable<int>`

a sequence of samples from the distribution.

#### voidSamples(Int32[] values)

Fills an array with samples generated from the distribution.

#### stringToString()

Returns a String that represents this instance.
##### Return
###### `string`

A String that represents this instance.

### Public Properties

#### doubleEntropy get;

Gets the entropy of the distribution.

#### intLowerBound get;

Gets the inclusive lower bound of the probability distribution.

#### intMaximum get;

Gets the largest element in the domain of the distributions which can be represented by an integer.

#### doubleMean get;

Gets the mean of the distribution.

#### doubleMedian get;

Gets the median of the distribution.

#### intMinimum get;

Gets the smallest element in the domain of the distributions which can be represented by an integer.

#### intMode get;

Gets the mode of the distribution; since every element in the domain has the same probability this method returns the middle one.

#### RandomRandomSource get; set;

Gets or sets the random number generator which is used to draw random samples.

#### doubleSkewness get;

Gets the skewness of the distribution.

#### doubleStdDev get;

Gets the standard deviation of the distribution.

#### intUpperBound get;

Gets the inclusive upper bound of the probability distribution.

#### doubleVariance get;

Gets the variance of the distribution.