diff --git a/src/Numerics/Distributions/Bernoulli.cs b/src/Numerics/Distributions/Bernoulli.cs
index 30fbd82c..cec06831 100644
--- a/src/Numerics/Distributions/Bernoulli.cs
+++ b/src/Numerics/Distributions/Bernoulli.cs
@@ -59,7 +59,7 @@ namespace MathNet.Numerics.Distributions
/// If the Bernoulli parameter is not in the range [0,1].
public Bernoulli(double p)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(p);
}
@@ -71,7 +71,7 @@ namespace MathNet.Numerics.Distributions
/// If the Bernoulli parameter is not in the range [0,1].
public Bernoulli(double p, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(p);
}
@@ -124,7 +124,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Beta.cs b/src/Numerics/Distributions/Beta.cs
index 8e428b60..1ea2ee4d 100644
--- a/src/Numerics/Distributions/Beta.cs
+++ b/src/Numerics/Distributions/Beta.cs
@@ -66,7 +66,7 @@ namespace MathNet.Numerics.Distributions
/// The β shape parameter of the Beta distribution. Range: β ≥ 0.
public Beta(double a, double b)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(a, b);
}
@@ -78,7 +78,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Beta(double a, double b, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(a, b);
}
@@ -132,7 +132,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Binomial.cs b/src/Numerics/Distributions/Binomial.cs
index 1f3c63f1..241aa104 100644
--- a/src/Numerics/Distributions/Binomial.cs
+++ b/src/Numerics/Distributions/Binomial.cs
@@ -62,7 +62,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Binomial(double p, int n)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(p, n);
}
@@ -76,7 +76,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Binomial(double p, int n, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(p, n);
}
@@ -142,7 +142,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Categorical.cs b/src/Numerics/Distributions/Categorical.cs
index ca98c341..3e19db09 100644
--- a/src/Numerics/Distributions/Categorical.cs
+++ b/src/Numerics/Distributions/Categorical.cs
@@ -66,7 +66,7 @@ namespace MathNet.Numerics.Distributions
/// If any of the probabilities are negative or do not sum to one.
public Categorical(double[] probabilityMass)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(probabilityMass);
}
@@ -79,7 +79,7 @@ namespace MathNet.Numerics.Distributions
/// If any of the probabilities are negative or do not sum to one.
public Categorical(double[] probabilityMass, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(probabilityMass);
}
@@ -105,7 +105,7 @@ namespace MathNet.Numerics.Distributions
p[i] = histogram[i].Count;
}
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(p);
}
@@ -208,7 +208,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Cauchy.cs b/src/Numerics/Distributions/Cauchy.cs
index f7dde704..95bca0c5 100644
--- a/src/Numerics/Distributions/Cauchy.cs
+++ b/src/Numerics/Distributions/Cauchy.cs
@@ -66,7 +66,7 @@ namespace MathNet.Numerics.Distributions
/// The scale (γ) of the distribution. Range: γ > 0.
public Cauchy(double location, double scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(location, scale);
}
@@ -78,7 +78,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Cauchy(double location, double scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(location, scale);
}
@@ -132,7 +132,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Chi.cs b/src/Numerics/Distributions/Chi.cs
index a62ea32d..2d795dc9 100644
--- a/src/Numerics/Distributions/Chi.cs
+++ b/src/Numerics/Distributions/Chi.cs
@@ -59,7 +59,7 @@ namespace MathNet.Numerics.Distributions
/// The degrees of freedom (k) of the distribution. Range: k > 0.
public Chi(double freedom)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(freedom);
}
@@ -70,7 +70,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Chi(double freedom, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(freedom);
}
@@ -113,7 +113,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/ChiSquared.cs b/src/Numerics/Distributions/ChiSquared.cs
index be1969c1..fafa7af0 100644
--- a/src/Numerics/Distributions/ChiSquared.cs
+++ b/src/Numerics/Distributions/ChiSquared.cs
@@ -57,7 +57,7 @@ namespace MathNet.Numerics.Distributions
/// The degrees of freedom (k) of the distribution. Range: k > 0.
public ChiSquared(double freedom)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(freedom);
}
@@ -68,7 +68,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public ChiSquared(double freedom, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(freedom);
}
@@ -111,7 +111,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/ContinuousUniform.cs b/src/Numerics/Distributions/ContinuousUniform.cs
index 7b13cec8..cadef445 100644
--- a/src/Numerics/Distributions/ContinuousUniform.cs
+++ b/src/Numerics/Distributions/ContinuousUniform.cs
@@ -67,7 +67,7 @@ namespace MathNet.Numerics.Distributions
/// If the upper bound is smaller than the lower bound.
public ContinuousUniform(double lower, double upper)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(lower, upper);
}
@@ -80,7 +80,7 @@ namespace MathNet.Numerics.Distributions
/// If the upper bound is smaller than the lower bound.
public ContinuousUniform(double lower, double upper, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(lower, upper);
}
@@ -134,7 +134,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/ConwayMaxwellPoisson.cs b/src/Numerics/Distributions/ConwayMaxwellPoisson.cs
index 2568ec90..fbff7995 100644
--- a/src/Numerics/Distributions/ConwayMaxwellPoisson.cs
+++ b/src/Numerics/Distributions/ConwayMaxwellPoisson.cs
@@ -87,7 +87,7 @@ namespace MathNet.Numerics.Distributions
/// The rate of decay (ν) parameter. Range: ν ≥ 0.
public ConwayMaxwellPoisson(double lambda, double nu)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(lambda, nu);
}
@@ -99,7 +99,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public ConwayMaxwellPoisson(double lambda, double nu, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(lambda, nu);
}
@@ -164,7 +164,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Dirichlet.cs b/src/Numerics/Distributions/Dirichlet.cs
index f3eb9810..f72d2a9e 100644
--- a/src/Numerics/Distributions/Dirichlet.cs
+++ b/src/Numerics/Distributions/Dirichlet.cs
@@ -57,7 +57,7 @@ namespace MathNet.Numerics.Distributions
/// An array with the Dirichlet parameters.
public Dirichlet(double[] alpha)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(alpha);
}
@@ -69,7 +69,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Dirichlet(double[] alpha, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(alpha);
}
@@ -87,7 +87,7 @@ namespace MathNet.Numerics.Distributions
parm[i] = alpha;
}
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(parm);
}
@@ -106,7 +106,7 @@ namespace MathNet.Numerics.Distributions
parm[i] = alpha;
}
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(parm);
}
@@ -180,7 +180,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/DiscreteUniform.cs b/src/Numerics/Distributions/DiscreteUniform.cs
index 3a38c891..5f6e9f21 100644
--- a/src/Numerics/Distributions/DiscreteUniform.cs
+++ b/src/Numerics/Distributions/DiscreteUniform.cs
@@ -60,7 +60,7 @@ namespace MathNet.Numerics.Distributions
/// Upper bound. Range: lower ≤ upper.
public DiscreteUniform(int lower, int upper)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(lower, upper);
}
@@ -72,7 +72,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public DiscreteUniform(int lower, int upper, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(lower, upper);
}
@@ -139,7 +139,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Erlang.cs b/src/Numerics/Distributions/Erlang.cs
index d7c48104..f5e64604 100644
--- a/src/Numerics/Distributions/Erlang.cs
+++ b/src/Numerics/Distributions/Erlang.cs
@@ -60,7 +60,7 @@ namespace MathNet.Numerics.Distributions
/// The rate or inverse scale (λ) of the Erlang distribution. Range: λ ≥ 0.
public Erlang(int shape, double rate)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(shape, rate);
}
@@ -72,7 +72,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Erlang(int shape, double rate, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, rate);
}
@@ -167,7 +167,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Exponential.cs b/src/Numerics/Distributions/Exponential.cs
index f78a2e74..eb404bef 100644
--- a/src/Numerics/Distributions/Exponential.cs
+++ b/src/Numerics/Distributions/Exponential.cs
@@ -57,7 +57,7 @@ namespace MathNet.Numerics.Distributions
/// The rate (λ) parameter of the distribution. Range: λ ≥ 0.
public Exponential(double rate)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(rate);
}
@@ -68,7 +68,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Exponential(double rate, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(rate);
}
@@ -111,7 +111,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/FisherSnedecor.cs b/src/Numerics/Distributions/FisherSnedecor.cs
index 928d9621..403ec4d3 100644
--- a/src/Numerics/Distributions/FisherSnedecor.cs
+++ b/src/Numerics/Distributions/FisherSnedecor.cs
@@ -59,7 +59,7 @@ namespace MathNet.Numerics.Distributions
/// The second degree of freedom (d2) of the distribution. Range: d2 > 0.
public FisherSnedecor(double d1, double d2)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(d1, d2);
}
@@ -71,7 +71,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public FisherSnedecor(double d1, double d2, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(d1, d2);
}
@@ -125,7 +125,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Gamma.cs b/src/Numerics/Distributions/Gamma.cs
index ce573dd6..bcb73daa 100644
--- a/src/Numerics/Distributions/Gamma.cs
+++ b/src/Numerics/Distributions/Gamma.cs
@@ -67,7 +67,7 @@ namespace MathNet.Numerics.Distributions
/// The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.
public Gamma(double shape, double rate)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(shape, rate);
}
@@ -79,7 +79,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Gamma(double shape, double rate, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, rate);
}
@@ -174,7 +174,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Geometric.cs b/src/Numerics/Distributions/Geometric.cs
index d5c5181d..7725ff72 100644
--- a/src/Numerics/Distributions/Geometric.cs
+++ b/src/Numerics/Distributions/Geometric.cs
@@ -58,7 +58,7 @@ namespace MathNet.Numerics.Distributions
/// The probability (p) of generating one. Range: 0 ≤ p ≤ 1.
public Geometric(double p)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(p);
}
@@ -69,7 +69,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Geometric(double p, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(p);
}
@@ -122,7 +122,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Hypergeometric.cs b/src/Numerics/Distributions/Hypergeometric.cs
index e54c44f5..3be4d4be 100644
--- a/src/Numerics/Distributions/Hypergeometric.cs
+++ b/src/Numerics/Distributions/Hypergeometric.cs
@@ -64,7 +64,7 @@ namespace MathNet.Numerics.Distributions
/// The number of draws without replacement (n).
public Hypergeometric(int population, int success, int draws)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(population, success, draws);
}
@@ -77,7 +77,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Hypergeometric(int population, int success, int draws, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(population, success, draws);
}
@@ -129,7 +129,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/InverseGamma.cs b/src/Numerics/Distributions/InverseGamma.cs
index d80c5c58..5590b872 100644
--- a/src/Numerics/Distributions/InverseGamma.cs
+++ b/src/Numerics/Distributions/InverseGamma.cs
@@ -61,7 +61,7 @@ namespace MathNet.Numerics.Distributions
/// The scale (β) of the distribution. Range: β > 0.
public InverseGamma(double shape, double scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(shape, scale);
}
@@ -73,7 +73,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public InverseGamma(double shape, double scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, scale);
}
@@ -127,7 +127,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/InverseWishart.cs b/src/Numerics/Distributions/InverseWishart.cs
index 03486e96..be9b98aa 100644
--- a/src/Numerics/Distributions/InverseWishart.cs
+++ b/src/Numerics/Distributions/InverseWishart.cs
@@ -66,7 +66,7 @@ namespace MathNet.Numerics.Distributions
/// The scale matrix (Ψ) for the inverse Wishart distribution.
public InverseWishart(double degreesOfFreedom, Matrix scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(degreesOfFreedom, scale);
}
@@ -78,7 +78,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public InverseWishart(double degreesOfFreedom, Matrix scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(degreesOfFreedom, scale);
}
@@ -157,7 +157,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Laplace.cs b/src/Numerics/Distributions/Laplace.cs
index 79d26af1..3daa4f04 100644
--- a/src/Numerics/Distributions/Laplace.cs
+++ b/src/Numerics/Distributions/Laplace.cs
@@ -70,7 +70,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Laplace(double location, double scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(location, scale);
}
@@ -83,7 +83,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Laplace(double location, double scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(location, scale);
}
@@ -137,7 +137,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/LogNormal.cs b/src/Numerics/Distributions/LogNormal.cs
index 891881a6..32625670 100644
--- a/src/Numerics/Distributions/LogNormal.cs
+++ b/src/Numerics/Distributions/LogNormal.cs
@@ -63,7 +63,7 @@ namespace MathNet.Numerics.Distributions
/// The shape (σ) of the logarithm of the distribution. Range: σ ≥ 0.
public LogNormal(double mu, double sigma)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(mu, sigma);
}
@@ -77,7 +77,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public LogNormal(double mu, double sigma, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(mu, sigma);
}
@@ -169,7 +169,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/MatrixNormal.cs b/src/Numerics/Distributions/MatrixNormal.cs
index b886a922..4f2fb515 100644
--- a/src/Numerics/Distributions/MatrixNormal.cs
+++ b/src/Numerics/Distributions/MatrixNormal.cs
@@ -75,7 +75,7 @@ namespace MathNet.Numerics.Distributions
/// If the dimensions of the mean and two covariance matrices don't match.
public MatrixNormal(Matrix m, Matrix v, Matrix k)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(m, v, k);
}
@@ -89,7 +89,7 @@ namespace MathNet.Numerics.Distributions
/// If the dimensions of the mean and two covariance matrices don't match.
public MatrixNormal(Matrix m, Matrix v, Matrix k, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(m, v, k);
}
@@ -199,7 +199,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Multinomial.cs b/src/Numerics/Distributions/Multinomial.cs
index 6a5b92ea..143f764c 100644
--- a/src/Numerics/Distributions/Multinomial.cs
+++ b/src/Numerics/Distributions/Multinomial.cs
@@ -75,7 +75,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Multinomial(double[] p, int n)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(p, n);
}
@@ -90,7 +90,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Multinomial(double[] p, int n, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(p, n);
}
@@ -119,7 +119,7 @@ namespace MathNet.Numerics.Distributions
}
SetParameters(p, n);
- RandomSource = MersenneTwister.Default;
+ RandomSource = SystemRandomSource.Default;
}
///
@@ -202,7 +202,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/NegativeBinomial.cs b/src/Numerics/Distributions/NegativeBinomial.cs
index ad93ba63..5bd187c9 100644
--- a/src/Numerics/Distributions/NegativeBinomial.cs
+++ b/src/Numerics/Distributions/NegativeBinomial.cs
@@ -61,7 +61,7 @@ namespace MathNet.Numerics.Distributions
/// The probability (p) of a trial resulting in success. Range: 0 ≤ p ≤ 1.
public NegativeBinomial(double r, double p)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(r, p);
}
@@ -73,7 +73,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public NegativeBinomial(double r, double p, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(r, p);
}
@@ -140,7 +140,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
/// Gets the mean of the distribution.
diff --git a/src/Numerics/Distributions/Normal.cs b/src/Numerics/Distributions/Normal.cs
index 30882749..9086a369 100644
--- a/src/Numerics/Distributions/Normal.cs
+++ b/src/Numerics/Distributions/Normal.cs
@@ -82,7 +82,7 @@ namespace MathNet.Numerics.Distributions
/// The standard deviation (σ) of the normal distribution. Range: σ ≥ 0.
public Normal(double mean, double stddev)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(mean, stddev);
}
@@ -95,7 +95,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Normal(double mean, double stddev, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(mean, stddev);
}
@@ -225,7 +225,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/NormalGamma.cs b/src/Numerics/Distributions/NormalGamma.cs
index c5befeab..25bc75f9 100644
--- a/src/Numerics/Distributions/NormalGamma.cs
+++ b/src/Numerics/Distributions/NormalGamma.cs
@@ -119,7 +119,7 @@ namespace MathNet.Numerics.Distributions
/// The inverse scale of the precision.
public NormalGamma(double meanLocation, double meanScale, double precisionShape, double precisionInverseScale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(meanLocation, meanScale, precisionShape, precisionInverseScale);
}
@@ -133,7 +133,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public NormalGamma(double meanLocation, double meanScale, double precisionShape, double precisionInverseScale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(meanLocation, meanScale, precisionShape, precisionInverseScale);
}
@@ -223,7 +223,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Pareto.cs b/src/Numerics/Distributions/Pareto.cs
index 9d395356..79851be1 100644
--- a/src/Numerics/Distributions/Pareto.cs
+++ b/src/Numerics/Distributions/Pareto.cs
@@ -62,7 +62,7 @@ namespace MathNet.Numerics.Distributions
/// If or are negative.
public Pareto(double scale, double shape)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(scale, shape);
}
@@ -75,7 +75,7 @@ namespace MathNet.Numerics.Distributions
/// If or are negative.
public Pareto(double scale, double shape, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(scale, shape);
}
@@ -129,7 +129,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Poisson.cs b/src/Numerics/Distributions/Poisson.cs
index bfbf275a..a5529f2b 100644
--- a/src/Numerics/Distributions/Poisson.cs
+++ b/src/Numerics/Distributions/Poisson.cs
@@ -56,7 +56,7 @@ namespace MathNet.Numerics.Distributions
/// If is equal or less then 0.0.
public Poisson(double lambda)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(lambda);
}
@@ -68,7 +68,7 @@ namespace MathNet.Numerics.Distributions
/// If is equal or less then 0.0.
public Poisson(double lambda, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(lambda);
}
@@ -123,7 +123,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Rayleigh.cs b/src/Numerics/Distributions/Rayleigh.cs
index cc73f680..bbe53fec 100644
--- a/src/Numerics/Distributions/Rayleigh.cs
+++ b/src/Numerics/Distributions/Rayleigh.cs
@@ -61,7 +61,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Rayleigh(double scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(scale);
}
@@ -73,7 +73,7 @@ namespace MathNet.Numerics.Distributions
/// If is negative.
public Rayleigh(double scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(scale);
}
@@ -116,7 +116,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Stable.cs b/src/Numerics/Distributions/Stable.cs
index bf3b7013..fabf1f8f 100644
--- a/src/Numerics/Distributions/Stable.cs
+++ b/src/Numerics/Distributions/Stable.cs
@@ -66,7 +66,7 @@ namespace MathNet.Numerics.Distributions
/// The location (μ) of the distribution.
public Stable(double alpha, double beta, double scale, double location)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(alpha, beta, scale, location);
}
@@ -80,7 +80,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Stable(double alpha, double beta, double scale, double location, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(alpha, beta, scale, location);
}
@@ -157,7 +157,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/StudentT.cs b/src/Numerics/Distributions/StudentT.cs
index df0ec871..c52f4e36 100644
--- a/src/Numerics/Distributions/StudentT.cs
+++ b/src/Numerics/Distributions/StudentT.cs
@@ -70,7 +70,7 @@ namespace MathNet.Numerics.Distributions
///
public StudentT()
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(0.0, 1.0, 1.0);
}
@@ -83,7 +83,7 @@ namespace MathNet.Numerics.Distributions
/// The degrees of freedom (ν) for the distribution. Range: ν > 0.
public StudentT(double location, double scale, double freedom)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(location, scale, freedom);
}
@@ -97,7 +97,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public StudentT(double location, double scale, double freedom, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(location, scale, freedom);
}
@@ -162,7 +162,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Triangular.cs b/src/Numerics/Distributions/Triangular.cs
index 0636f40e..24e51994 100644
--- a/src/Numerics/Distributions/Triangular.cs
+++ b/src/Numerics/Distributions/Triangular.cs
@@ -60,7 +60,7 @@ namespace MathNet.Numerics.Distributions
/// If the upper bound is smaller than the mode or if the mode is smaller than the lower bound.
public Triangular(double lower, double upper, double mode)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(lower, upper, mode);
}
@@ -74,7 +74,7 @@ namespace MathNet.Numerics.Distributions
/// If the upper bound is smaller than the mode or if the mode is smaller than the lower bound.
public Triangular(double lower, double upper, double mode, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(lower, upper, mode);
}
@@ -130,7 +130,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Weibull.cs b/src/Numerics/Distributions/Weibull.cs
index 81e559e2..b779e8ca 100644
--- a/src/Numerics/Distributions/Weibull.cs
+++ b/src/Numerics/Distributions/Weibull.cs
@@ -70,7 +70,7 @@ namespace MathNet.Numerics.Distributions
/// The scale (λ) of the Weibull distribution. Range: λ > 0.
public Weibull(double shape, double scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(shape, scale);
}
@@ -82,7 +82,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Weibull(double shape, double scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(shape, scale);
}
@@ -137,7 +137,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Wishart.cs b/src/Numerics/Distributions/Wishart.cs
index 406f558e..00186d60 100644
--- a/src/Numerics/Distributions/Wishart.cs
+++ b/src/Numerics/Distributions/Wishart.cs
@@ -75,7 +75,7 @@ namespace MathNet.Numerics.Distributions
/// The scale matrix (V) for the Wishart distribution.
public Wishart(double degreesOfFreedom, Matrix scale)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(degreesOfFreedom, scale);
}
@@ -87,7 +87,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Wishart(double degreesOfFreedom, Matrix scale, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(degreesOfFreedom, scale);
}
@@ -171,15 +171,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException();
- }
-
- _random = value;
- }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///
diff --git a/src/Numerics/Distributions/Zipf.cs b/src/Numerics/Distributions/Zipf.cs
index e8346882..28034add 100644
--- a/src/Numerics/Distributions/Zipf.cs
+++ b/src/Numerics/Distributions/Zipf.cs
@@ -69,7 +69,7 @@ namespace MathNet.Numerics.Distributions
/// The n parameter of the distribution.
public Zipf(double s, int n)
{
- _random = MersenneTwister.Default;
+ _random = SystemRandomSource.Default;
SetParameters(s, n);
}
@@ -81,7 +81,7 @@ namespace MathNet.Numerics.Distributions
/// The random number generator which is used to draw random samples.
public Zipf(double s, int n, System.Random randomSource)
{
- _random = randomSource ?? MersenneTwister.Default;
+ _random = randomSource ?? SystemRandomSource.Default;
SetParameters(s, n);
}
@@ -146,7 +146,7 @@ namespace MathNet.Numerics.Distributions
public System.Random RandomSource
{
get { return _random; }
- set { _random = value ?? MersenneTwister.Default; }
+ set { _random = value ?? SystemRandomSource.Default; }
}
///