From 92a3b0c040aedf6014a6d95e7081d96d35e68fad Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Sat, 7 Aug 2021 14:35:59 +0200 Subject: [PATCH] Replace calls to deprecated method. --- .../core/ExtendedFieldElementAbstractTest.java | 16 ++++++++-------- .../legacy/core/jdkmath/AccurateMathTest.java | 8 +++----- .../commons/math4/legacy/PerfTestUtils.java | 2 +- .../DerivativeStructureTest.java | 4 ++-- .../differentiation/SparseGradientTest.java | 6 ++---- .../legacy/analysis/function/LogitTest.java | 5 ++--- .../AkimaSplineInterpolatorTest.java | 2 +- .../BicubicInterpolatingFunctionTest.java | 2 +- .../interpolation/BicubicInterpolatorTest.java | 2 +- ...BicubicSplineInterpolatingFunctionTest.java | 2 +- ...PiecewiseBicubicSplineInterpolatorTest.java | 4 ++-- .../TricubicInterpolatingFunctionTest.java | 2 +- .../UnivariatePeriodicInterpolatorTest.java | 2 +- .../EnumeratedIntegerDistributionTest.java | 2 +- .../EnumeratedRealDistributionTest.java | 4 ++-- .../IntegerDistributionAbstractTest.java | 3 +-- ...tureMultivariateNormalDistributionTest.java | 2 +- .../MultivariateNormalDistributionTest.java | 2 +- .../RealDistributionAbstractTest.java | 2 +- .../ExtendedFieldElementAbstractTest.java | 16 ++++++++-------- .../math4/legacy/filter/KalmanFilterTest.java | 2 +- .../fitting/PolynomialCurveFitterTest.java | 3 +-- .../legacy/fitting/SimpleCurveFitterTest.java | 3 +-- .../RandomCirclePointGenerator.java | 2 +- .../RandomStraightLinePointGenerator.java | 2 +- .../legacy/linear/EigenDecompositionTest.java | 3 +-- .../linear/HessenbergTransformerTest.java | 3 +-- .../legacy/linear/SchurTransformerTest.java | 3 +-- .../clustering/FuzzyKMeansClustererTest.java | 2 +- .../KMeansPlusPlusClustererTest.java | 2 +- .../MiniBatchKMeansClustererTest.java | 2 +- .../evaluation/CalinskiHarabaszTest.java | 4 ++-- .../legacy/ode/events/EventFilterTest.java | 2 +- .../MultiStartMultivariateOptimizerTest.java | 4 ++-- .../scalar/noderiv/CMAESOptimizerTest.java | 8 ++++---- .../scalar/noderiv/OptimTestUtils.java | 2 +- .../MultiStartUnivariateOptimizerTest.java | 10 +++++----- .../random/CorrelatedVectorFactoryTest.java | 6 +++--- .../correlation/KendallsCorrelationTest.java | 2 +- .../correlation/StorelessCovarianceTest.java | 2 +- .../AggregateSummaryStatisticsTest.java | 8 +++----- .../descriptive/DescriptiveStatisticsTest.java | 2 +- .../descriptive/ResizableDoubleArrayTest.java | 4 ++-- .../UnivariateStatisticAbstractTest.java | 6 ++---- .../rank/PSquarePercentileTest.java | 4 ++-- .../stat/descriptive/rank/PercentileTest.java | 3 +-- .../inference/KolmogorovSmirnovTestTest.java | 18 +++++++++--------- .../stat/ranking/NaturalRankingTest.java | 4 ++-- .../GLSMultipleLinearRegressionTest.java | 2 +- .../stat/regression/SimpleRegressionTest.java | 2 +- .../math4/neuralnet/MapRankingTest.java | 4 ++-- .../commons/math4/neuralnet/NetworkTest.java | 2 +- .../math4/neuralnet/oned/NeuronStringTest.java | 2 +- .../sofm/KohonenUpdateActionTest.java | 2 +- .../neuralnet/twod/NeuronSquareMesh2DTest.java | 2 +- .../twod/util/LocationFinderTest.java | 2 +- .../transform/FastFourierTransformerTest.java | 2 +- .../transform/RealTransformerAbstractTest.java | 2 +- 58 files changed, 105 insertions(+), 121 deletions(-) diff --git a/commons-math-legacy-core/src/test/java/org/apache/commons/math4/legacy/core/ExtendedFieldElementAbstractTest.java b/commons-math-legacy-core/src/test/java/org/apache/commons/math4/legacy/core/ExtendedFieldElementAbstractTest.java index 258c887d3..bf57129f8 100644 --- a/commons-math-legacy-core/src/test/java/org/apache/commons/math4/legacy/core/ExtendedFieldElementAbstractTest.java +++ b/commons-math-legacy-core/src/test/java/org/apache/commons/math4/legacy/core/ExtendedFieldElementAbstractTest.java @@ -391,7 +391,7 @@ public abstract class ExtendedFieldElementAbstractTest> list = new ArrayList<>(); list.add(new Pair(new Object() {}, new Double(0))); list.add(new Pair(new Object() {}, new Double(1))); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_512_A); + final UniformRandomProvider rng = RandomSource.WELL_512_A.create(); Assert.assertEquals(1, new EnumeratedDistribution<>(list).createSampler(rng).sample(1).length); } diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/IntegerDistributionAbstractTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/IntegerDistributionAbstractTest.java index 5e3771006..fc565399e 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/IntegerDistributionAbstractTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/IntegerDistributionAbstractTest.java @@ -298,8 +298,7 @@ public abstract class IntegerDistributionAbstractTest { } // Use fixed seed. final DiscreteDistribution.Sampler sampler = - distribution.createSampler(RandomSource.create(RandomSource.WELL_512_A, - 1000)); + distribution.createSampler(RandomSource.WELL_512_A.create(1000)); int[] sample = AbstractIntegerDistribution.sample(sampleSize, sampler); for (int i = 0; i < sampleSize; i++) { for (int j = 0; j < length; j++) { diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MixtureMultivariateNormalDistributionTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MixtureMultivariateNormalDistributionTest.java index d50c1590f..6037ad1e0 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MixtureMultivariateNormalDistributionTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MixtureMultivariateNormalDistributionTest.java @@ -124,7 +124,7 @@ public class MixtureMultivariateNormalDistributionTest { final MixtureMultivariateNormalDistribution d = new MixtureMultivariateNormalDistribution(weights, means, covariances); final MultivariateRealDistribution.Sampler sampler = - d.createSampler(RandomSource.create(RandomSource.WELL_19937_C, 50)); + d.createSampler(RandomSource.WELL_19937_C.create(50)); final double[][] correctSamples = getCorrectSamples(); final int n = correctSamples.length; diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MultivariateNormalDistributionTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MultivariateNormalDistributionTest.java index 9ea82ca52..0cf6d9ec0 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MultivariateNormalDistributionTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/MultivariateNormalDistributionTest.java @@ -76,7 +76,7 @@ public class MultivariateNormalDistributionTest { { -1.1, 2 } }; final MultivariateNormalDistribution d = new MultivariateNormalDistribution(mu, sigma); final MultivariateRealDistribution.Sampler sampler = - d.createSampler(RandomSource.create(RandomSource.WELL_19937_C, 50)); + d.createSampler(RandomSource.WELL_19937_C.create(50)); final int n = 500000; final double[][] samples = AbstractMultivariateRealDistribution.sample(n, sampler); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/RealDistributionAbstractTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/RealDistributionAbstractTest.java index 61e2188f6..116a5d3f2 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/RealDistributionAbstractTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/distribution/RealDistributionAbstractTest.java @@ -327,7 +327,7 @@ public abstract class RealDistributionAbstractTest { public void testSampler() { final int sampleSize = 1000; final ContinuousDistribution.Sampler sampler = - distribution.createSampler(RandomSource.create(RandomSource.WELL_19937_C, 123456789L)); + distribution.createSampler(RandomSource.WELL_19937_C.create(123456789L)); final double[] sample = AbstractRealDistribution.sample(sampleSize, sampler); final double[] quartiles = TestUtils.getDistributionQuartiles(distribution); final double[] expected = {250, 250, 250, 250}; diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/field/ExtendedFieldElementAbstractTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/field/ExtendedFieldElementAbstractTest.java index 17cb29101..5bb45753c 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/field/ExtendedFieldElementAbstractTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/field/ExtendedFieldElementAbstractTest.java @@ -393,7 +393,7 @@ public abstract class ExtendedFieldElementAbstractTest clusterer = new FuzzyKMeansClusterer<>(3, 2.0, 100, measure, 1e-6, random); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClustererTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClustererTest.java index 980478464..a9e497901 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClustererTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClustererTest.java @@ -36,7 +36,7 @@ public class KMeansPlusPlusClustererTest { @Before public void setUp() { - random = RandomSource.create(RandomSource.MT_64, 1746432956321L); + random = RandomSource.MT_64.create(1746432956321L); } /** diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/MiniBatchKMeansClustererTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/MiniBatchKMeansClustererTest.java index 4b5dce41b..ca6c7d1a6 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/MiniBatchKMeansClustererTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/MiniBatchKMeansClustererTest.java @@ -55,7 +55,7 @@ public class MiniBatchKMeansClustererTest { @Test public void testCompareToKMeans() { //Generate 4 cluster - final UniformRandomProvider rng = RandomSource.create(RandomSource.MT_64); + final UniformRandomProvider rng = RandomSource.MT_64.create(); List data = generateCircles(rng); KMeansPlusPlusClusterer kMeans = new KMeansPlusPlusClusterer<>(4, -1, DEFAULT_MEASURE, rng); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/evaluation/CalinskiHarabaszTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/evaluation/CalinskiHarabaszTest.java index a98c5929f..03f5295b6 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/evaluation/CalinskiHarabaszTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ml/clustering/evaluation/CalinskiHarabaszTest.java @@ -46,7 +46,7 @@ public class CalinskiHarabaszTest { public void test_k_equals_4_is_best_for_a_4_center_points() { final int dimension = 2; final double[][] centers = {{-1, -1}, {0, 0}, {1, 1}, {2, 2}}; - final UniformRandomProvider rnd = RandomSource.create(RandomSource.MT_64); + final UniformRandomProvider rnd = RandomSource.MT_64.create(); final List points = new ArrayList<>(); // Generate 1000 points around 4 centers for test. for (int i = 0; i < 1000; i++) { @@ -80,7 +80,7 @@ public class CalinskiHarabaszTest { @Test public void test_compare_to_skLearn() { - final UniformRandomProvider rnd = RandomSource.create(RandomSource.MT_64); + final UniformRandomProvider rnd = RandomSource.MT_64.create(); final List points = new ArrayList<>(); for (double[] p : dataFromSkLearn) { points.add(new DoublePoint(p)); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ode/events/EventFilterTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ode/events/EventFilterTest.java index 947d0a449..9df7bcc5c 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ode/events/EventFilterTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/ode/events/EventFilterTest.java @@ -115,7 +115,7 @@ public class EventFilterTest { } // verify old events are preserved, even if randomly accessed - UniformRandomProvider rng = RandomSource.create(RandomSource.TWO_CMRES, 0xb0e7401265af8cd3L); + UniformRandomProvider rng = RandomSource.TWO_CMRES.create(0xb0e7401265af8cd3L); for (int i = 0; i < 5000; i++) { double t = t0 + (t1 - t0) * rng.nextDouble(); double g = eventFilter.g(t, new double[] { AccurateMath.sin(t), AccurateMath.cos(t) }); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java index 275babb2a..2e1137248 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java @@ -52,7 +52,7 @@ public class MultiStartMultivariateOptimizerTest { new SimpleValueChecker(1e-10, 1e-10)); final Supplier generator = gaussianRandom(new double[] { 50, 50 }, new double[] { 10, 10 }, - RandomSource.create(RandomSource.MT_64)); + RandomSource.MT_64.create()); int nbStarts = 10; MultiStartMultivariateOptimizer optimizer = new MultiStartMultivariateOptimizer(underlying, nbStarts, generator); @@ -93,7 +93,7 @@ public class MultiStartMultivariateOptimizerTest { }); final Supplier generator = gaussianRandom(new double[] { 0, 0 }, new double[] { 1, 1 }, - RandomSource.create(RandomSource.MT_64)); + RandomSource.MT_64.create()); int nbStarts = 10; MultiStartMultivariateOptimizer optimizer = new MultiStartMultivariateOptimizer(underlying, nbStarts, generator); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java index 92d823c16..6b307b0a9 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java @@ -158,7 +158,7 @@ public class CMAESOptimizerTest { public void testMath1466() { final CMAESOptimizer optimizer = new CMAESOptimizer(30000, Double.NEGATIVE_INFINITY, true, 10, - 0, RandomSource.create(RandomSource.MT_64), false, null); + 0, RandomSource.MT_64.create(), false, null); final MultivariateFunction fitnessFunction = new MultivariateFunction() { @Override public double value(double[] x) { @@ -389,7 +389,7 @@ public class CMAESOptimizerTest { public void testMath864() { final CMAESOptimizer optimizer = new CMAESOptimizer(30000, 0, true, 10, - 0, RandomSource.create(RandomSource.MT_64), false, null); + 0, RandomSource.MT_64.create(), false, null); final MultivariateFunction fitnessFunction = new MultivariateFunction() { @Override public double value(double[] parameters) { @@ -421,7 +421,7 @@ public class CMAESOptimizerTest { public void testFitAccuracyDependsOnBoundary() { final CMAESOptimizer optimizer = new CMAESOptimizer(30000, 0, true, 10, - 0, RandomSource.create(RandomSource.MT_64), false, null); + 0, RandomSource.MT_64.create(), false, null); final MultivariateFunction fitnessFunction = new MultivariateFunction() { @Override public double value(double[] parameters) { @@ -509,7 +509,7 @@ public class CMAESOptimizerTest { int dim = startPoint.length; // test diagonalOnly = 0 - slow but normally fewer feval# CMAESOptimizer optim = new CMAESOptimizer(30000, stopValue, isActive, diagonalOnly, - 0, RandomSource.create(RandomSource.MT_64), false, null); + 0, RandomSource.MT_64.create(), false, null); PointValuePair result = boundaries == null ? optim.optimize(new MaxEval(maxEvaluations), new ObjectiveFunction(func), diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/OptimTestUtils.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/OptimTestUtils.java index 2522218f8..283f0ff1a 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/OptimTestUtils.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/OptimTestUtils.java @@ -113,7 +113,7 @@ final class OptimTestUtils { /** Creates a RNG instance. */ static UniformRandomProvider rng() { - return RandomSource.create(RandomSource.MWC_256); + return RandomSource.MWC_256.create(); } private static class Basis { diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/univariate/MultiStartUnivariateOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/univariate/MultiStartUnivariateOptimizerTest.java index c928269f5..476b98095 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/univariate/MultiStartUnivariateOptimizerTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/univariate/MultiStartUnivariateOptimizerTest.java @@ -32,7 +32,7 @@ public class MultiStartUnivariateOptimizerTest { @Test(expected=MathIllegalStateException.class) public void testMissingMaxEval() { UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); - UniformRandomProvider g = RandomSource.create(RandomSource.TWO_CMRES, 44428400075L); + UniformRandomProvider g = RandomSource.TWO_CMRES.create(44428400075L); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 10, g); optimizer.optimize(new UnivariateObjectiveFunction(new Sin()), GoalType.MINIMIZE, @@ -41,7 +41,7 @@ public class MultiStartUnivariateOptimizerTest { @Test(expected=MathIllegalStateException.class) public void testMissingSearchInterval() { UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); - UniformRandomProvider g = RandomSource.create(RandomSource.TWO_CMRES, 44428400075L); + UniformRandomProvider g = RandomSource.TWO_CMRES.create(44428400075L); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 10, g); optimizer.optimize(new MaxEval(300), new UnivariateObjectiveFunction(new Sin()), @@ -52,7 +52,7 @@ public class MultiStartUnivariateOptimizerTest { public void testSinMin() { UnivariateFunction f = new Sin(); UnivariateOptimizer underlying = new BrentOptimizer(1e-10, 1e-14); - UniformRandomProvider g = RandomSource.create(RandomSource.TWO_CMRES, 44428400075L); + UniformRandomProvider g = RandomSource.TWO_CMRES.create(44428400075L); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 10, g); optimizer.optimize(new MaxEval(300), new UnivariateObjectiveFunction(f), @@ -73,7 +73,7 @@ public class MultiStartUnivariateOptimizerTest { public void testQuinticMin() { UnivariateFunction f = new QuinticFunction(); UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14); - UniformRandomProvider g = RandomSource.create(RandomSource.TWO_CMRES, 4312000053L); + UniformRandomProvider g = RandomSource.TWO_CMRES.create(4312000053L); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 5, g); UnivariatePointValuePair optimum @@ -104,7 +104,7 @@ public class MultiStartUnivariateOptimizerTest { } }; UnivariateOptimizer underlying = new BrentOptimizer(1e-9, 1e-14); - UniformRandomProvider g = RandomSource.create(RandomSource.TWO_CMRES, 4312000053L); + UniformRandomProvider g = RandomSource.TWO_CMRES.create(4312000053L); MultiStartUnivariateOptimizer optimizer = new MultiStartUnivariateOptimizer(underlying, 5, g); try { diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/CorrelatedVectorFactoryTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/CorrelatedVectorFactoryTest.java index 286c1eaea..64829a7e6 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/CorrelatedVectorFactoryTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/random/CorrelatedVectorFactoryTest.java @@ -61,7 +61,7 @@ public class CorrelatedVectorFactoryTest { generator = new CorrelatedVectorFactory(mean, covariance, 1e-12 * covariance.getNorm()) - .gaussian(RandomSource.create(RandomSource.KISS)); + .gaussian(RandomSource.KISS.create()); } @Test @@ -75,7 +75,7 @@ public class CorrelatedVectorFactoryTest { }; final RealMatrix covRM = MatrixUtils.createRealMatrix(cov); final Supplier sg = new CorrelatedVectorFactory(mean, covRM, 1e-5) - .gaussian(RandomSource.create(RandomSource.WELL_1024_A)); + .gaussian(RandomSource.WELL_1024_A.create()); final double[] min = new double[mean.length]; Arrays.fill(min, Double.POSITIVE_INFINITY); @@ -149,7 +149,7 @@ public class CorrelatedVectorFactoryTest { final RealMatrix matrix = new Array2DRowRealMatrix(cov); final double small = 1e-12 * matrix.getNorm(); return new CorrelatedVectorFactory(matrix, small) - .gaussian(RandomSource.create(RandomSource.WELL_1024_A)); + .gaussian(RandomSource.WELL_1024_A.create()); } private void testSampler(final double[][] covMatrix, diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/KendallsCorrelationTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/KendallsCorrelationTest.java index 22eb6fd1b..bca164e44 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/KendallsCorrelationTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/KendallsCorrelationTest.java @@ -265,7 +265,7 @@ public class KendallsCorrelationTest extends PearsonsCorrelationTest { public void testMath1277() { // example that led to a correlation coefficient outside of [-1, 1] // due to a bug reported in MATH-1277 - UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_1024_A, 0); + UniformRandomProvider rng = RandomSource.WELL_1024_A.create(0); double[] xArray = new double[120000]; double[] yArray = new double[120000]; for (int i = 0; i < xArray.length; ++i) { diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/StorelessCovarianceTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/StorelessCovarianceTest.java index b2af1331e..9cbf775c9 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/StorelessCovarianceTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/correlation/StorelessCovarianceTest.java @@ -234,7 +234,7 @@ public class StorelessCovarianceTest { StorelessBivariateCovariance cov = new StorelessBivariateCovariance();// covariance of the superset StorelessBivariateCovariance chk = new StorelessBivariateCovariance();// check covariance made by appending covariance of subsets - final UniformRandomProvider rand = RandomSource.create(RandomSource.ISAAC, 10L);// Seed can be changed + final UniformRandomProvider rand = RandomSource.ISAAC.create(10L);// Seed can be changed for (int s = 0; s < num_sets; s++) {// loop through sets of samlpes StorelessBivariateCovariance covs = new StorelessBivariateCovariance(); for (int i = 0; i < 5; i++) { // loop through individual samlpes. diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/AggregateSummaryStatisticsTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/AggregateSummaryStatisticsTest.java index 199642db2..23f1835b0 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/AggregateSummaryStatisticsTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/AggregateSummaryStatisticsTest.java @@ -283,11 +283,9 @@ public class AggregateSummaryStatisticsTest { */ private double[] generateSample() { final DiscreteDistribution.Sampler size = - new UniformDiscreteDistribution(10, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A, - 327652)); + new UniformDiscreteDistribution(10, 100).createSampler(RandomSource.WELL_512_A.create(327652)); final ContinuousDistribution.Sampler randomData - = new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A, - 64925784252L)); + = new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.WELL_512_A.create(64925784252L)); final int sampleSize = size.sample(); final double[] out = AbstractRealDistribution.sample(sampleSize, randomData); return out; @@ -315,7 +313,7 @@ public class AggregateSummaryStatisticsTest { next = length - 1; } else { final DiscreteDistribution.Sampler sampler = - new UniformDiscreteDistribution(cur, length - 1).createSampler(RandomSource.create(RandomSource.WELL_512_A)); + new UniformDiscreteDistribution(cur, length - 1).createSampler(RandomSource.WELL_512_A.create()); next = sampler.sample(); } final int subLength = next - cur + 1; diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/DescriptiveStatisticsTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/DescriptiveStatisticsTest.java index 3c5427421..163984831 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/DescriptiveStatisticsTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/DescriptiveStatisticsTest.java @@ -38,7 +38,7 @@ import org.junit.Test; * Test cases for the {@link DescriptiveStatistics} class. */ public class DescriptiveStatisticsTest { - private static UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A, 2345789432894L); + private static UniformRandomProvider random = RandomSource.WELL_1024_A.create(2345789432894L); protected DescriptiveStatistics createDescriptiveStatistics() { return new DescriptiveStatistics(); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/ResizableDoubleArrayTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/ResizableDoubleArrayTest.java index 220cfcc91..478d629a9 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/ResizableDoubleArrayTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/ResizableDoubleArrayTest.java @@ -324,7 +324,7 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { Assert.assertEquals("Initial number of elements should be 0", 0, eDA2.getNumElements()); final DiscreteDistribution.Sampler randomData = - new UniformDiscreteDistribution(100, 1000).createSampler(RandomSource.create(RandomSource.WELL_19937_C)); + new UniformDiscreteDistribution(100, 1000).createSampler(RandomSource.WELL_19937_C.create()); final int iterations = randomData.sample(); for( int i = 0; i < iterations; i++) { @@ -346,7 +346,7 @@ public class ResizableDoubleArrayTest extends DoubleArrayAbstractTest { Assert.assertEquals("Initial number of elements should be 0", 0, eDA3.getNumElements() ); final DiscreteDistribution.Sampler randomData = - new UniformDiscreteDistribution(100, 3000).createSampler(RandomSource.create(RandomSource.WELL_19937_C)); + new UniformDiscreteDistribution(100, 3000).createSampler(RandomSource.WELL_19937_C.create()); final int iterations = randomData.sample(); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/UnivariateStatisticAbstractTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/UnivariateStatisticAbstractTest.java index f9572f6ce..9595af1a7 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/UnivariateStatisticAbstractTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/UnivariateStatisticAbstractTest.java @@ -178,8 +178,7 @@ public abstract class UnivariateStatisticAbstractTest { // Fill weights array with random int values between 1 and 5 int[] intWeights = new int[len]; final DiscreteDistribution.Sampler weightDist = - new UniformDiscreteDistribution(1, 5).createSampler(RandomSource.create(RandomSource.WELL_512_A, - 234878544L)); + new UniformDiscreteDistribution(1, 5).createSampler(RandomSource.WELL_512_A.create(234878544L)); for (int i = 0; i < len; i++) { intWeights[i] = weightDist.sample(); weights[i] = intWeights[i]; @@ -189,8 +188,7 @@ public abstract class UnivariateStatisticAbstractTest { // and fill valuesList with values from values array with // values[i] repeated weights[i] times, each i final ContinuousDistribution.Sampler valueDist = - new NormalDistribution(mu, sigma).createSampler(RandomSource.create(RandomSource.WELL_512_A, - 64925784252L)); + new NormalDistribution(mu, sigma).createSampler(RandomSource.WELL_512_A.create(64925784252L)); List valuesList = new ArrayList<>(); for (int i = 0; i < len; i++) { double value = valueDist.sample(); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PSquarePercentileTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PSquarePercentileTest.java index b05571c12..99e8430c4 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PSquarePercentileTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PSquarePercentileTest.java @@ -52,7 +52,7 @@ public class PSquarePercentileTest extends protected double percentile95 = 16.72195;// 20.82d; this is approximation protected double tolerance = 10E-12; - private final UniformRandomProvider randomGenerator = RandomSource.create(RandomSource.WELL_19937_C, 1000); + private final UniformRandomProvider randomGenerator = RandomSource.WELL_19937_C.create(1000); @Override public double getTolerance() { @@ -715,7 +715,7 @@ public class PSquarePercentileTest extends private void doDistributionTest(ContinuousDistribution distribution) { final ContinuousDistribution.Sampler sampler = - distribution.createSampler(RandomSource.create(RandomSource.WELL_19937_C, 1000)); + distribution.createSampler(RandomSource.WELL_19937_C.create(1000)); double data[]; data = AbstractRealDistribution.sample(VERY_LARGE, sampler); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PercentileTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PercentileTest.java index 1c45d815f..936b454b8 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PercentileTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/descriptive/rank/PercentileTest.java @@ -590,8 +590,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{ @Test public void testStoredVsDirect() { final ContinuousDistribution.Sampler sampler = - new NormalDistribution(4000, 50).createSampler(RandomSource.create(RandomSource.JDK, - Long.MAX_VALUE)); + new NormalDistribution(4000, 50).createSampler(RandomSource.JDK.create(Long.MAX_VALUE)); for (final int sampleSize : sampleSizes) { final double[] data = AbstractRealDistribution.sample(sampleSize, sampler); diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTestTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTestTest.java index d67ae3b03..4d63f133d 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTestTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTestTest.java @@ -323,7 +323,7 @@ public class KolmogorovSmirnovTestTest { @Test public void testTwoSampleMonteCarlo() { final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); final int sampleSize = 14; final double tol = .001; final double[] shortUniform = new double[sampleSize]; @@ -351,7 +351,7 @@ public class KolmogorovSmirnovTestTest { @Test public void testTwoSampleMonteCarloDifferentSampleSizes() { final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); final int sampleSize1 = 14; final int sampleSize2 = 7; final double d = 0.3; @@ -371,7 +371,7 @@ public class KolmogorovSmirnovTestTest { int numIterations = 100_000; int N = (int)Math.sqrt(LARGE_SAMPLE_PRODUCT); final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); for (int n = 2; n <= N; ++n) { long startMillis = System.currentTimeMillis(); int m = LARGE_SAMPLE_PRODUCT/n; @@ -592,7 +592,7 @@ public class KolmogorovSmirnovTestTest { public void testTwoSamplesAllEqual() { int iterations = 10_000; final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); for (int i = 2; i < 30; ++i) { // testing values with ties double[] values = new double[i]; @@ -653,7 +653,7 @@ public class KolmogorovSmirnovTestTest { final double tol = 1e-2; final int iterations = 1000000; final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); final double[] x = {0, 2, 3, 4, 5, 6, 7, 8, 9, 12}; final double[] y = {1, 10, 11, 13, 14, 15, 16, 17, 18}; @@ -682,7 +682,7 @@ public class KolmogorovSmirnovTestTest { final double alpha = 0.001; final int numIterations = 1000000; - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 0); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(0); for (final int[] parameter : parameters) { @@ -732,7 +732,7 @@ public class KolmogorovSmirnovTestTest { final double[] x = {0, 2, 4, 6, 8, 8, 10, 15, 22, 30, 33, 36, 38}; final double[] y = {9, 17, 20, 33, 40, 51, 60, 60, 72, 90, 101}; final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 2000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(2000); Assert.assertEquals(0.0059, test.bootstrap(x, y, 10000, false, rng), 1E-3); } @@ -743,7 +743,7 @@ public class KolmogorovSmirnovTestTest { @Test public void testBootstrapLargeSamples() { final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); Assert.assertEquals(0.0237, test.bootstrap(gaussian, gaussian2, 10000, true, rng), 1E-2); } @@ -757,7 +757,7 @@ public class KolmogorovSmirnovTestTest { final double[] x = {2,4,6,8,9,10,11,12,13}; final double[] y = {0,1,3,5,7}; final KolmogorovSmirnovTest test = new KolmogorovSmirnovTest(); - final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1000); + final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1000); Assert.assertEquals(0.06303, test.bootstrap(x, y, 10000, false, rng), 1E-2); } diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRankingTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRankingTest.java index ddb1bd49b..4696dc4b8 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRankingTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRankingTest.java @@ -180,7 +180,7 @@ public class NaturalRankingTest { final int num = 10000000; final long max = start + num; for (long i = start; i <= max; i++) { - UniformRandomProvider randomGenerator = RandomSource.create(RandomSource.MT, i); + UniformRandomProvider randomGenerator = RandomSource.MT.create(i); NaturalRanking ranking = new NaturalRanking(NaNStrategy.FIXED, randomGenerator); double[] ranks = ranking.rank(exampleData); @@ -229,7 +229,7 @@ public class NaturalRankingTest { @Ignore @Test public void testNaNsFixedTiesRandom() { - UniformRandomProvider randomGenerator = RandomSource.create(RandomSource.SPLIT_MIX_64); + UniformRandomProvider randomGenerator = RandomSource.SPLIT_MIX_64.create(); NaturalRanking ranking = new NaturalRanking(NaNStrategy.FIXED, randomGenerator); double[] ranks = ranking.rank(exampleData); double[] correctRanks = { 5, 3, 6, 7, 3, 8, Double.NaN, 1, 2 }; diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/GLSMultipleLinearRegressionTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/GLSMultipleLinearRegressionTest.java index 7d217bb18..2c1778376 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/GLSMultipleLinearRegressionTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/GLSMultipleLinearRegressionTest.java @@ -222,7 +222,7 @@ public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs */ @Test public void testGLSEfficiency() { - final UniformRandomProvider rg = RandomSource.create(RandomSource.MT); + final UniformRandomProvider rg = RandomSource.MT.create(); final ContinuousDistribution.Sampler gauss = new NormalDistribution(0, 1).createSampler(rg); // Assume model has 16 observations (will use Longley data). Start by generating diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/SimpleRegressionTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/SimpleRegressionTest.java index d1b7eb0b7..0b8df2b6d 100644 --- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/SimpleRegressionTest.java +++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/stat/regression/SimpleRegressionTest.java @@ -132,7 +132,7 @@ public final class SimpleRegressionTest { */ private void check(boolean includeIntercept) { final int sets = 2; - final UniformRandomProvider rand = RandomSource.create(RandomSource.ISAAC, 10L);// Seed can be changed + final UniformRandomProvider rand = RandomSource.ISAAC.create(10L);// Seed can be changed final SimpleRegression whole = new SimpleRegression(includeIntercept);// regression of the whole set final SimpleRegression parts = new SimpleRegression(includeIntercept);// regression with parts. diff --git a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/MapRankingTest.java b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/MapRankingTest.java index a4113fbb2..fb31a3c3f 100644 --- a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/MapRankingTest.java +++ b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/MapRankingTest.java @@ -40,7 +40,7 @@ public class MapRankingTest { */ @Test public void testFindClosestNeuron() { - final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); final FeatureInitializer init = new OffsetFeatureInitializer(FeatureInitializerFactory.uniform(rng, -0.1, 0.1)); final FeatureInitializer[] initArray = {init}; @@ -96,7 +96,7 @@ public class MapRankingTest { @Test(expected = IllegalArgumentException.class) public void testRankPrecondition() { - final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); final FeatureInitializer init = new OffsetFeatureInitializer(FeatureInitializerFactory.uniform(rng, -0.1, 0.1)); final FeatureInitializer[] initArray = {init}; diff --git a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/NetworkTest.java b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/NetworkTest.java index e8b5d99c8..b413bb1bc 100644 --- a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/NetworkTest.java +++ b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/NetworkTest.java @@ -37,7 +37,7 @@ import org.apache.commons.math4.neuralnet.twod.NeuronSquareMesh2D; * Tests for {@link Network}. */ public class NetworkTest { - private final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); private final FeatureInitializer init = FeatureInitializerFactory.uniform(rng, 0, 2); @Test diff --git a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/oned/NeuronStringTest.java b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/oned/NeuronStringTest.java index b6b990f24..889ab7007 100644 --- a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/oned/NeuronStringTest.java +++ b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/oned/NeuronStringTest.java @@ -41,7 +41,7 @@ import org.apache.commons.math4.neuralnet.Neuron; * a one-dimensional network. */ public class NeuronStringTest { - private final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); private final FeatureInitializer init = FeatureInitializerFactory.uniform(rng, 0, 2); /* diff --git a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/sofm/KohonenUpdateActionTest.java b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/sofm/KohonenUpdateActionTest.java index 96e7da6db..a445bad43 100644 --- a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/sofm/KohonenUpdateActionTest.java +++ b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/sofm/KohonenUpdateActionTest.java @@ -38,7 +38,7 @@ import org.apache.commons.math4.neuralnet.oned.NeuronString; * Tests for {@link KohonenUpdateAction} class. */ public class KohonenUpdateActionTest { - private final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); /* * Test assumes that the network is diff --git a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/NeuronSquareMesh2DTest.java b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/NeuronSquareMesh2DTest.java index 641c01b5f..ec56755d7 100644 --- a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/NeuronSquareMesh2DTest.java +++ b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/NeuronSquareMesh2DTest.java @@ -46,7 +46,7 @@ import org.apache.commons.math4.neuralnet.SquareNeighbourhood; * a two-dimensional network. */ public class NeuronSquareMesh2DTest { - private final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); private final FeatureInitializer init = FeatureInitializerFactory.uniform(rng, 0, 2); @Test(expected = IllegalArgumentException.class) diff --git a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/util/LocationFinderTest.java b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/util/LocationFinderTest.java index e951190bf..32ccfff8d 100644 --- a/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/util/LocationFinderTest.java +++ b/commons-math-neuralnet/src/test/java/org/apache/commons/math4/neuralnet/twod/util/LocationFinderTest.java @@ -32,7 +32,7 @@ import org.junit.Test; * Test for {@link LocationFinder}. */ public class LocationFinderTest { - private final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64); + private final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(); private final FeatureInitializer init = FeatureInitializerFactory.uniform(rng, 0, 2); /* diff --git a/commons-math-transform/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java b/commons-math-transform/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java index 2095618cc..d4d31bc11 100644 --- a/commons-math-transform/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java +++ b/commons-math-transform/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java @@ -40,7 +40,7 @@ public final class FastFourierTransformerTest { private static final DoubleUnaryOperator SIN = x -> SIN_FUNCTION.value(x); /** RNG. */ - private static final UniformRandomProvider RNG = RandomSource.create(RandomSource.MWC_256); + private static final UniformRandomProvider RNG = RandomSource.MWC_256.create(); // Precondition checks. diff --git a/commons-math-transform/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java b/commons-math-transform/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java index 50f5710ef..36cdf2f33 100644 --- a/commons-math-transform/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java +++ b/commons-math-transform/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java @@ -36,7 +36,7 @@ import org.apache.commons.rng.simple.RandomSource; */ public abstract class RealTransformerAbstractTest { /** RNG. */ - private static final UniformRandomProvider RNG = RandomSource.create(RandomSource.MWC_256); + private static final UniformRandomProvider RNG = RandomSource.MWC_256.create(); /** * Returns a new instance of the {@link RealTransform} to be tested.