Uniform: Constructs a new uniform discrete distribution.

Constructs a new uniform discrete distribution.
<param name="a">
The integer value where the distribution starts, also
known as <c>a</c>. Default value is 0.</param>
<param name="b">
The integer value where the distribution ends, also
known as <c>b</c>.</param>

/// <summary>
/// Constructs a new uniform discrete distribution.
/// </summary>
///
/// <param name="a">
/// The integer value where the distribution starts, also
/// known as <c>a</c>. Default value is 0.</param>
/// <param name="b">
/// The integer value where the distribution ends, also
/// known as <c>b</c>.</param>
///
public static GeneralDiscreteDistribution Uniform(int a, int b)
{
if (a > b)
{
throw new ArgumentOutOfRangeException("b",
"The starting number a must be lower than b.");
}
return new GeneralDiscreteDistribution(a, b - a + 1);
}

/// <summary>
/// Constructs a new uniform discrete distribution.
/// </summary>
///
/// <param name="a">
/// The integer value where the distribution starts, also
/// known as <c>a</c>. Default value is 0.</param>
/// <param name="b">
/// The integer value where the distribution ends, also
/// known as <c>b</c>.</param>
///
public static GeneralDiscreteDistribution Uniform(int a, int b)
{
if (a > b)
{
throw new ArgumentOutOfRangeException("b",
"The starting number a must be lower than b.");
}
return new GeneralDiscreteDistribution(a, b - a + 1);
}

If you want to be updated about similar snippets,

Sign in
and follow our

Channels