diff --git a/src/Numerics/Distributions/Beta.cs b/src/Numerics/Distributions/Beta.cs
index d7fa9013..e99d6240 100644
--- a/src/Numerics/Distributions/Beta.cs
+++ b/src/Numerics/Distributions/Beta.cs
@@ -561,5 +561,27 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, a, b);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The α shape parameter of the Beta distribution. Range: α ≥ 0.
+ /// The β shape parameter of the Beta distribution. Range: β ≥ 0.
+ /// a sample from the distribution.
+ public static double Sample(double a, double b)
+ {
+ return Sample(SystemRandomSource.Default, a, b);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The α shape parameter of the Beta distribution. Range: α ≥ 0.
+ /// The β shape parameter of the Beta distribution. Range: β ≥ 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double a, double b)
+ {
+ return Samples(SystemRandomSource.Default, a, b);
+ }
}
}
diff --git a/src/Numerics/Distributions/Cauchy.cs b/src/Numerics/Distributions/Cauchy.cs
index 6d86338d..52727cf0 100644
--- a/src/Numerics/Distributions/Cauchy.cs
+++ b/src/Numerics/Distributions/Cauchy.cs
@@ -361,5 +361,27 @@ namespace MathNet.Numerics.Distributions
yield return location + scale*Math.Tan(Constants.Pi*(rnd.NextDouble() - 0.5));
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The location (x0) of the distribution.
+ /// The scale (γ) of the distribution. Range: γ > 0.
+ /// a sample from the distribution.
+ public static double Sample(double location, double scale)
+ {
+ return Sample(SystemRandomSource.Default, location, scale);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The location (x0) of the distribution.
+ /// The scale (γ) of the distribution. Range: γ > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double location, double scale)
+ {
+ return Samples(SystemRandomSource.Default, location, scale);
+ }
}
}
diff --git a/src/Numerics/Distributions/Chi.cs b/src/Numerics/Distributions/Chi.cs
index ec4441d5..7446ece1 100644
--- a/src/Numerics/Distributions/Chi.cs
+++ b/src/Numerics/Distributions/Chi.cs
@@ -337,5 +337,25 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, freedom);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The degrees of freedom (k) of the distribution. Range: k > 0.
+ /// a sample from the distribution.
+ public static double Sample(int freedom)
+ {
+ return Sample(SystemRandomSource.Default, freedom);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The degrees of freedom (k) of the distribution. Range: k > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(int freedom)
+ {
+ return Samples(SystemRandomSource.Default, freedom);
+ }
}
}
diff --git a/src/Numerics/Distributions/ChiSquared.cs b/src/Numerics/Distributions/ChiSquared.cs
index 35780c25..8b3f7665 100644
--- a/src/Numerics/Distributions/ChiSquared.cs
+++ b/src/Numerics/Distributions/ChiSquared.cs
@@ -330,5 +330,25 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, freedom);
}
}
+
+ ///
+ /// Generates a sample from the ChiSquare distribution.
+ ///
+ /// The degrees of freedom (k) of the distribution. Range: k > 0.
+ /// a sample from the distribution.
+ public static double Sample(double freedom)
+ {
+ return Sample(SystemRandomSource.Default, freedom);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The degrees of freedom (k) of the distribution. Range: k > 0.
+ /// a sample from the distribution.
+ public static IEnumerable Samples(double freedom)
+ {
+ return Samples(SystemRandomSource.Default, freedom);
+ }
}
}
diff --git a/src/Numerics/Distributions/ContinuousUniform.cs b/src/Numerics/Distributions/ContinuousUniform.cs
index 36c8d935..9102f6f5 100644
--- a/src/Numerics/Distributions/ContinuousUniform.cs
+++ b/src/Numerics/Distributions/ContinuousUniform.cs
@@ -364,5 +364,27 @@ namespace MathNet.Numerics.Distributions
yield return lower + rnd.NextDouble()*(upper - lower);
}
}
+
+ ///
+ /// Generates a sample from the ContinuousUniform distribution.
+ ///
+ /// Lower bound. Range: lower ≤ upper.
+ /// Upper bound. Range: lower ≤ upper.
+ /// a uniformly distributed sample.
+ public static double Sample(double lower, double upper)
+ {
+ return Sample(SystemRandomSource.Default, lower, upper);
+ }
+
+ ///
+ /// Generates a sequence of samples from the ContinuousUniform distribution.
+ ///
+ /// Lower bound. Range: lower ≤ upper.
+ /// Upper bound. Range: lower ≤ upper.
+ /// a sequence of uniformly distributed samples.
+ public static IEnumerable Samples(double lower, double upper)
+ {
+ return Samples(SystemRandomSource.Default, lower, upper);
+ }
}
}
diff --git a/src/Numerics/Distributions/Erlang.cs b/src/Numerics/Distributions/Erlang.cs
index 82401fda..08a73223 100644
--- a/src/Numerics/Distributions/Erlang.cs
+++ b/src/Numerics/Distributions/Erlang.cs
@@ -514,5 +514,27 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, shape, rate);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The shape (k) of the Erlang distribution. Range: k ≥ 0.
+ /// The rate or inverse scale (λ) of the Erlang distribution. Range: λ ≥ 0.
+ /// a sample from the distribution.
+ public static double Sample(double shape, double rate)
+ {
+ return Sample(SystemRandomSource.Default, shape, rate);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The shape (k) of the Erlang distribution. Range: k ≥ 0.
+ /// The rate or inverse scale (λ) of the Erlang distribution. Range: λ ≥ 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double shape, double rate)
+ {
+ return Samples(SystemRandomSource.Default, shape, rate);
+ }
}
}
diff --git a/src/Numerics/Distributions/Exponential.cs b/src/Numerics/Distributions/Exponential.cs
index 95639a02..ea560659 100644
--- a/src/Numerics/Distributions/Exponential.cs
+++ b/src/Numerics/Distributions/Exponential.cs
@@ -349,5 +349,25 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, rate);
}
}
+
+ ///
+ /// Draws a random sample from the distribution.
+ ///
+ /// The rate (λ) parameter of the distribution. Range: λ ≥ 0.
+ /// A random number from this distribution.
+ public static double Sample(double rate)
+ {
+ return Sample(SystemRandomSource.Default, rate);
+ }
+
+ ///
+ /// Generates a sequence of samples from the Exponential distribution.
+ ///
+ /// The rate (λ) parameter of the distribution. Range: λ ≥ 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double rate)
+ {
+ return Samples(SystemRandomSource.Default, rate);
+ }
}
}
diff --git a/src/Numerics/Distributions/FisherSnedecor.cs b/src/Numerics/Distributions/FisherSnedecor.cs
index e7cc83b1..8b4d2c1b 100644
--- a/src/Numerics/Distributions/FisherSnedecor.cs
+++ b/src/Numerics/Distributions/FisherSnedecor.cs
@@ -399,5 +399,27 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, d1, d2);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The first degree of freedom (d1) of the distribution. Range: d1 > 0.
+ /// The second degree of freedom (d2) of the distribution. Range: d2 > 0.
+ /// a sample from the distribution.
+ public static double Sample(double d1, double d2)
+ {
+ return Sample(SystemRandomSource.Default, d1, d2);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The first degree of freedom (d1) of the distribution. Range: d1 > 0.
+ /// The second degree of freedom (d2) of the distribution. Range: d2 > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double d1, double d2)
+ {
+ return Samples(SystemRandomSource.Default, d1, d2);
+ }
}
}
diff --git a/src/Numerics/Distributions/Gamma.cs b/src/Numerics/Distributions/Gamma.cs
index 734b1e4e..2e61206f 100644
--- a/src/Numerics/Distributions/Gamma.cs
+++ b/src/Numerics/Distributions/Gamma.cs
@@ -546,5 +546,27 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, shape, rate);
}
}
+
+ ///
+ /// Generates a sample from the Gamma distribution.
+ ///
+ /// The shape (k, α) of the Gamma distribution. Range: α ≥ 0.
+ /// The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.
+ /// a sample from the distribution.
+ public static double Sample(double shape, double rate)
+ {
+ return Sample(SystemRandomSource.Default, shape, rate);
+ }
+
+ ///
+ /// Generates a sequence of samples from the Gamma distribution.
+ ///
+ /// The shape (k, α) of the Gamma distribution. Range: α ≥ 0.
+ /// The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double shape, double rate)
+ {
+ return Samples(SystemRandomSource.Default, shape, rate);
+ }
}
}
diff --git a/src/Numerics/Distributions/InverseGamma.cs b/src/Numerics/Distributions/InverseGamma.cs
index 0629d991..a3a26f5a 100644
--- a/src/Numerics/Distributions/InverseGamma.cs
+++ b/src/Numerics/Distributions/InverseGamma.cs
@@ -343,5 +343,27 @@ namespace MathNet.Numerics.Distributions
return Gamma.Samples(rnd, shape, scale).Select(z => 1.0/z);
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The shape (α) of the distribution. Range: α > 0.
+ /// The scale (β) of the distribution. Range: β > 0.
+ /// a sample from the distribution.
+ public static double Sample(double shape, double scale)
+ {
+ return Sample(SystemRandomSource.Default, shape, scale);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The shape (α) of the distribution. Range: α > 0.
+ /// The scale (β) of the distribution. Range: β > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double shape, double scale)
+ {
+ return Samples(SystemRandomSource.Default, shape, scale);
+ }
}
}
diff --git a/src/Numerics/Distributions/Laplace.cs b/src/Numerics/Distributions/Laplace.cs
index 034ae1c5..6666067f 100644
--- a/src/Numerics/Distributions/Laplace.cs
+++ b/src/Numerics/Distributions/Laplace.cs
@@ -349,5 +349,27 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, location, scale);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The location (μ) of the distribution.
+ /// The scale (b) of the distribution. Range: b > 0.
+ /// a sample from the distribution.
+ public static double Sample(double location, double scale)
+ {
+ return Sample(SystemRandomSource.Default, location, scale);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The location (μ) of the distribution.
+ /// The scale (b) of the distribution. Range: b > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double location, double scale)
+ {
+ return Samples(SystemRandomSource.Default, location, scale);
+ }
}
}
diff --git a/src/Numerics/Distributions/LogNormal.cs b/src/Numerics/Distributions/LogNormal.cs
index 17022903..27624e11 100644
--- a/src/Numerics/Distributions/LogNormal.cs
+++ b/src/Numerics/Distributions/LogNormal.cs
@@ -429,5 +429,27 @@ namespace MathNet.Numerics.Distributions
{
return Normal.Samples(rnd, mu, sigma).Select(Math.Exp);
}
+
+ ///
+ /// Generates a sample from the log-normal distribution using the Box-Muller algorithm.
+ ///
+ /// The log-scale (μ) of the distribution.
+ /// The shape (σ) of the distribution. Range: σ ≥ 0.
+ /// a sample from the distribution.
+ public static double Sample(double mu, double sigma)
+ {
+ return Sample(SystemRandomSource.Default, mu, sigma);
+ }
+
+ ///
+ /// Generates a sequence of samples from the log-normal distribution using the Box-Muller algorithm.
+ ///
+ /// The log-scale (μ) of the distribution.
+ /// The shape (σ) of the distribution. Range: σ ≥ 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double mu, double sigma)
+ {
+ return Samples(SystemRandomSource.Default, mu, sigma);
+ }
}
}
diff --git a/src/Numerics/Distributions/Normal.cs b/src/Numerics/Distributions/Normal.cs
index 302da462..9e20fb7a 100644
--- a/src/Numerics/Distributions/Normal.cs
+++ b/src/Numerics/Distributions/Normal.cs
@@ -460,5 +460,27 @@ namespace MathNet.Numerics.Distributions
yield return mean + (stddev*sample.Item2);
}
}
+
+ ///
+ /// Generates a sample from the normal distribution using the Box-Muller algorithm.
+ ///
+ /// The mean (μ) of the normal distribution.
+ /// The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
+ /// a sample from the distribution.
+ public static double Sample(double mean, double stddev)
+ {
+ return Sample(SystemRandomSource.Default, mean, stddev);
+ }
+
+ ///
+ /// Generates a sequence of samples from the normal distribution using the Box-Muller algorithm.
+ ///
+ /// The mean (μ) of the normal distribution.
+ /// The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double mean, double stddev)
+ {
+ return Samples(SystemRandomSource.Default, mean, stddev);
+ }
}
}
diff --git a/src/Numerics/Distributions/Pareto.cs b/src/Numerics/Distributions/Pareto.cs
index 0092304b..f0061eb5 100644
--- a/src/Numerics/Distributions/Pareto.cs
+++ b/src/Numerics/Distributions/Pareto.cs
@@ -374,5 +374,27 @@ namespace MathNet.Numerics.Distributions
yield return scale*Math.Pow(rnd.NextDouble(), power);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The scale (xm) of the distribution. Range: xm > 0.
+ /// The shape (α) of the distribution. Range: α > 0.
+ /// a sample from the distribution.
+ public static double Sample(double scale, double shape)
+ {
+ return Sample(SystemRandomSource.Default, scale, shape);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The scale (xm) of the distribution. Range: xm > 0.
+ /// The shape (α) of the distribution. Range: α > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double scale, double shape)
+ {
+ return Samples(SystemRandomSource.Default, scale, shape);
+ }
}
}
diff --git a/src/Numerics/Distributions/Rayleigh.cs b/src/Numerics/Distributions/Rayleigh.cs
index ea9fdc6f..6685996f 100644
--- a/src/Numerics/Distributions/Rayleigh.cs
+++ b/src/Numerics/Distributions/Rayleigh.cs
@@ -337,5 +337,25 @@ namespace MathNet.Numerics.Distributions
yield return scale*Math.Sqrt(-2.0*Math.Log(rnd.NextDouble()));
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The scale (σ) of the distribution. Range: σ > 0.
+ /// a sample from the distribution.
+ public static double Sample(double scale)
+ {
+ return Sample(SystemRandomSource.Default, scale);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The scale (σ) of the distribution. Range: σ > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double scale)
+ {
+ return Samples(SystemRandomSource.Default, scale);
+ }
}
}
diff --git a/src/Numerics/Distributions/Stable.cs b/src/Numerics/Distributions/Stable.cs
index 25a251c2..8ab0f718 100644
--- a/src/Numerics/Distributions/Stable.cs
+++ b/src/Numerics/Distributions/Stable.cs
@@ -489,5 +489,31 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, alpha, beta, scale, location);
}
}
+
+ ///
+ /// Generates a sample from the distribution.
+ ///
+ /// The stability (α) of the distribution. Range: 2 ≥ α > 0.
+ /// The skewness (β) of the distribution. Range: 1 ≥ β ≥ -1.
+ /// The scale (c) of the distribution. Range: c > 0.
+ /// The location (μ) of the distribution.
+ /// a sample from the distribution.
+ public static double Sample(double alpha, double beta, double scale, double location)
+ {
+ return Sample(SystemRandomSource.Default, alpha, beta, scale, location);
+ }
+
+ ///
+ /// Generates a sequence of samples from the distribution.
+ ///
+ /// The stability (α) of the distribution. Range: 2 ≥ α > 0.
+ /// The skewness (β) of the distribution. Range: 1 ≥ β ≥ -1.
+ /// The scale (c) of the distribution. Range: c > 0.
+ /// The location (μ) of the distribution.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double alpha, double beta, double scale, double location)
+ {
+ return Samples(SystemRandomSource.Default, alpha, beta, scale, location);
+ }
}
}
diff --git a/src/Numerics/Distributions/StudentT.cs b/src/Numerics/Distributions/StudentT.cs
index 4d4b50ce..73785dd9 100644
--- a/src/Numerics/Distributions/StudentT.cs
+++ b/src/Numerics/Distributions/StudentT.cs
@@ -484,5 +484,29 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, location, scale, freedom);
}
}
+
+ ///
+ /// Generates a sample from the Student t-distribution.
+ ///
+ /// The location (μ) of the distribution.
+ /// The scale (σ) of the distribution. Range: σ > 0.
+ /// The degrees of freedom (ν) for the distribution. Range: ν > 0.
+ /// a sample from the distribution.
+ public static double Sample(double location, double scale, double freedom)
+ {
+ return Sample(SystemRandomSource.Default, location, scale, freedom);
+ }
+
+ ///
+ /// Generates a sequence of samples from the Student t-distribution using the Box-Muller algorithm.
+ ///
+ /// The location (μ) of the distribution.
+ /// The scale (σ) of the distribution. Range: σ > 0.
+ /// The degrees of freedom (ν) for the distribution. Range: ν > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double location, double scale, double freedom)
+ {
+ return Samples(SystemRandomSource.Default, location, scale, freedom);
+ }
}
}
diff --git a/src/Numerics/Distributions/Triangular.cs b/src/Numerics/Distributions/Triangular.cs
index d853f874..011a8885 100644
--- a/src/Numerics/Distributions/Triangular.cs
+++ b/src/Numerics/Distributions/Triangular.cs
@@ -416,5 +416,28 @@ namespace MathNet.Numerics.Distributions
}
}
+ ///
+ /// Generates a sample from the Triangular distribution.
+ ///
+ /// Lower bound. Range: lower ≤ mode ≤ upper
+ /// Upper bound. Range: lower ≤ mode ≤ upper
+ /// Mode (most frequent value). Range: lower ≤ mode ≤ upper
+ /// a sample from the distribution.
+ public double Sample(double lower, double upper, double mode)
+ {
+ return Sample(SystemRandomSource.Default, lower, upper, mode);
+ }
+
+ ///
+ /// Generates a sequence of samples from the Triangular distribution.
+ ///
+ /// Lower bound. Range: lower ≤ mode ≤ upper
+ /// Upper bound. Range: lower ≤ mode ≤ upper
+ /// Mode (most frequent value). Range: lower ≤ mode ≤ upper
+ /// a sequence of samples from the distribution.
+ public IEnumerable Samples(double lower, double upper, double mode)
+ {
+ return Samples(SystemRandomSource.Default, lower, upper, mode);
+ }
}
}
diff --git a/src/Numerics/Distributions/Weibull.cs b/src/Numerics/Distributions/Weibull.cs
index 87861cd5..89ce3908 100644
--- a/src/Numerics/Distributions/Weibull.cs
+++ b/src/Numerics/Distributions/Weibull.cs
@@ -413,5 +413,27 @@ namespace MathNet.Numerics.Distributions
yield return SampleUnchecked(rnd, shape, scale);
}
}
+
+ ///
+ /// Generates a sample from the Weibull distribution.
+ ///
+ /// The shape (k) of the Weibull distribution. Range: k > 0.
+ /// The scale (λ) of the Weibull distribution. Range: λ > 0.
+ /// a sample from the distribution.
+ public static double Sample(double shape, double scale)
+ {
+ return Sample(SystemRandomSource.Default, shape, scale);
+ }
+
+ ///
+ /// Generates a sequence of samples from the Weibull distribution.
+ ///
+ /// The shape (k) of the Weibull distribution. Range: k > 0.
+ /// The scale (λ) of the Weibull distribution. Range: λ > 0.
+ /// a sequence of samples from the distribution.
+ public static IEnumerable Samples(double shape, double scale)
+ {
+ return Samples(SystemRandomSource.Default, shape, scale);
+ }
}
}