## Types in MathNet.Numerics.Distributions

Type Binomial

Namespace MathNet.Numerics.Distributions

Interfaces IDiscreteDistribution

The distribution is parameterized by a probability (between 0.0 and 1.0).

### Public Constructors

#### Binomial(double p, int n, Random randomSource)

Initializes a new instance of the Binomial class.
##### Parameters
###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `Random` randomSource

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

#### Binomial(double p, int n)

Initializes a new instance of the Binomial class.
##### Parameters
###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

### Public Static Functions

#### doubleCDF(double p, int n, double x)

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

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `double` x

The location at which to compute the cumulative distribution function.

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

the cumulative distribution at location x.

#### boolIsValidParameterSet(double p, int n)

Tests whether the provided values are valid parameters for this distribution.
##### Parameters
###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

#### doublePMF(double p, int n, int k)

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

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `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(double p, int n, int k)

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

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

###### `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, double p, int n)

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

The random number generator to use.

###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

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

The number of successes in n trials.

#### intSample(double p, int n)

Samples a binomially distributed random variable.
##### Parameters
###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

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

The number of successes in n trials.

#### voidSamples(Int32[] values, double p, int n)

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

The array to fill with the samples.

###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

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

a sequence of successes in n trials.

#### voidSamples(Random rnd, Int32[] values, double p, int n)

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.

###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

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

a sequence of successes in n trials.

#### IEnumerable<int>Samples(Random rnd, double p, int n)

Samples a sequence of binomially distributed random variable.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

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

a sequence of successes in n trials.

#### IEnumerable<int>Samples(double p, int n)

Samples a sequence of binomially distributed random variable.
##### Parameters
###### `double` p

The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.

###### `int` n

The number of trials (n). Range: n ≥ 0.

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

a sequence of successes in n trials.

### 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()

Samples a Binomially distributed random variable.
##### Return
###### `int`

The number of successes in N trials.

#### IEnumerable<int>Samples()

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

a sequence of successes in N trials.

#### voidSamples(Int32[] values)

Fills an array with samples generated from the distribution.

#### stringToString()

A string representation of the distribution.
##### Return
###### `string`

a string representation of the distribution.

### Public Properties

#### doubleEntropy get;

Gets the entropy of the 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.

#### Int32[]Modes get;

Gets all modes of the distribution.

#### intN get;

Gets the number of trials. Range: n ≥ 0.

#### doubleP get;

Gets the success probability in each trial. Range: 0 ≤ p ≤ 1.

#### 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.

#### doubleVariance get;

Gets the variance of the distribution.