Browse Source

Distributions: Erlang & Gamma: static WithXY with optional random source argument

pull/163/head
Christoph Ruegg 13 years ago
parent
commit
765dbcb5dd
  1. 10
      src/Numerics/Distributions/Erlang.cs
  2. 10
      src/Numerics/Distributions/Gamma.cs

10
src/Numerics/Distributions/Erlang.cs

@ -81,9 +81,10 @@ namespace MathNet.Numerics.Distributions
/// </summary>
/// <param name="shape">The shape (k) of the Erlang distribution. Range: k ≥ 0.</param>
/// <param name="scale">The scale (μ) of the Erlang distribution. Range: μ ≥ 0.</param>
public static Erlang WithShapeScale(int shape, double scale)
/// <param name="randomSource">The random number generator which is used to draw random samples. Optional, can be null.</param>
public static Erlang WithShapeScale(int shape, double scale, System.Random randomSource = null)
{
return new Erlang(shape, 1.0/scale);
return new Erlang(shape, 1.0/scale, randomSource);
}
/// <summary>
@ -92,9 +93,10 @@ namespace MathNet.Numerics.Distributions
/// </summary>
/// <param name="shape">The shape (k) of the Erlang distribution. Range: k ≥ 0.</param>
/// <param name="rate">The rate or inverse scale (λ) of the Erlang distribution. Range: λ ≥ 0.</param>
public static Erlang WithShapeRate(int shape, double rate)
/// <param name="randomSource">The random number generator which is used to draw random samples. Optional, can be null.</param>
public static Erlang WithShapeRate(int shape, double rate, System.Random randomSource = null)
{
return new Erlang(shape, rate);
return new Erlang(shape, rate, randomSource);
}
/// <summary>

10
src/Numerics/Distributions/Gamma.cs

@ -88,9 +88,10 @@ namespace MathNet.Numerics.Distributions
/// </summary>
/// <param name="shape">The shape (k) of the Gamma distribution. Range: k ≥ 0.</param>
/// <param name="scale">The scale (θ) of the Gamma distribution. Range: θ ≥ 0</param>
public static Gamma WithShapeScale(double shape, double scale)
/// <param name="randomSource">The random number generator which is used to draw random samples. Optional, can be null.</param>
public static Gamma WithShapeScale(double shape, double scale, System.Random randomSource = null)
{
return new Gamma(shape, 1.0/scale);
return new Gamma(shape, 1.0/scale, randomSource);
}
/// <summary>
@ -99,9 +100,10 @@ namespace MathNet.Numerics.Distributions
/// </summary>
/// <param name="shape">The shape (k, α) of the Gamma distribution. Range: α ≥ 0.</param>
/// <param name="rate">The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.</param>
public static Gamma WithShapeRate(double shape, double rate)
/// <param name="randomSource">The random number generator which is used to draw random samples. Optional, can be null.</param>
public static Gamma WithShapeRate(double shape, double rate, System.Random randomSource = null)
{
return new Gamma(shape, rate);
return new Gamma(shape, rate, randomSource);
}
/// <summary>

Loading…
Cancel
Save