Replace calls to deprecated method.

This commit is contained in:
Gilles Sadowski 2021-08-07 14:35:59 +02:00
parent 50ca244b38
commit 92a3b0c040
58 changed files with 105 additions and 121 deletions

View File

@ -391,7 +391,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFaFa() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xfafaL);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xfafaL);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 10);
double[] bD = generateDouble(r, 10);
@ -404,7 +404,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDaFa() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdafaL);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdafaL);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 10);
double[] bD = generateDouble(r, 10);
@ -416,7 +416,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFF2() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xff2L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xff2L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 2);
double[] bD = generateDouble(r, 2);
@ -431,7 +431,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDF2() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdf2L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdf2L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 2);
double[] bD = generateDouble(r, 2);
@ -445,7 +445,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFF3() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xff3L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xff3L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 3);
double[] bD = generateDouble(r, 3);
@ -461,7 +461,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDF3() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdf3L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdf3L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 3);
double[] bD = generateDouble(r, 3);
@ -476,7 +476,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFF4() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xff4L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xff4L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 4);
double[] bD = generateDouble(r, 4);
@ -493,7 +493,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDF4() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdf4L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdf4L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 4);
double[] bD = generateDouble(r, 4);

View File

@ -54,7 +54,7 @@ public class AccurateMathTest {
@Before
public void setUp() {
field = new DfpField(40);
generator = RandomSource.create(RandomSource.MT, 6176597458463500194L);
generator = RandomSource.MT.create(6176597458463500194L);
}
@Test
@ -1822,8 +1822,7 @@ public class AccurateMathTest {
@Test
public void testFloorDivModInt() {
UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_1024_A,
0x7ccab45edeaab90aL);
UniformRandomProvider rng = RandomSource.WELL_1024_A.create(0x7ccab45edeaab90aL);
for (int i = 0; i < 10000; ++i) {
int a = rng.nextInt();
int b = rng.nextInt();
@ -1895,8 +1894,7 @@ public class AccurateMathTest {
@Test
public void testFloorDivModLong() {
UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_1024_A,
0xb87b9bc14c96ccd5L);
UniformRandomProvider rng = RandomSource.WELL_1024_A.create(0xb87b9bc14c96ccd5L);
for (int i = 0; i < 10000; ++i) {
long a = rng.nextLong();
long b = rng.nextLong();

View File

@ -53,7 +53,7 @@ public final class PerfTestUtils {
/** Default number of code repeats for computing the average run time. */
private static final int DEFAULT_REPEAT_STAT = 10000;
/** RNG. */
private static UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C);
private static UniformRandomProvider rng = RandomSource.WELL_19937_C.create();
/** No instances. */
private PerfTestUtils() {}

View File

@ -1481,7 +1481,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
public void testLinearCombination2DSDS() {
// we compare accurate versus naive dot product implementations
// on regular vectors (i.e. not extreme cases like in the previous test)
UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A, 0xc6af886975069f11L);
UniformRandomProvider random = RandomSource.WELL_1024_A.create(0xc6af886975069f11L);
for (int i = 0; i < 10000; ++i) {
final DerivativeStructure[] u = new DerivativeStructure[4];
@ -1525,7 +1525,7 @@ public class DerivativeStructureTest extends ExtendedFieldElementAbstractTest<De
public void testLinearCombination2DoubleDS() {
// we compare accurate versus naive dot product implementations
// on regular vectors (i.e. not extreme cases like in the previous test)
UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A, 0xc6af886975069f11L);
UniformRandomProvider random = RandomSource.WELL_1024_A.create(0xc6af886975069f11L);
for (int i = 0; i < 10000; ++i) {
final double[] u = new double[4];

View File

@ -1023,8 +1023,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
public void testLinearCombination2DSDS() {
// we compare accurate versus naive dot product implementations
// on regular vectors (i.e. not extreme cases like in the previous test)
UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A,
0xc6af886975069f11L);
UniformRandomProvider random = RandomSource.WELL_1024_A.create(0xc6af886975069f11L);
for (int i = 0; i < 10000; ++i) {
final SparseGradient[] u = new SparseGradient[4];
@ -1068,8 +1067,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
public void testLinearCombination2DoubleDS() {
// we compare accurate versus naive dot product implementations
// on regular vectors (i.e. not extreme cases like in the previous test)
UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A,
0xc6af886975069f11L);
UniformRandomProvider random = RandomSource.WELL_1024_A.create(0xc6af886975069f11L);
for (int i = 0; i < 10000; ++i) {
final double[] u = new double[4];

View File

@ -158,8 +158,7 @@ public class LogitTest {
final double hi = 3;
final Logit f = new Logit(lo, hi);
final Sigmoid g = new Sigmoid(lo, hi);
final UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A,
0x49914cdd9f0b8db5L);
final UniformRandomProvider random = RandomSource.WELL_1024_A.create(0x49914cdd9f0b8db5L);
final UnivariateDifferentiableFunction id = FunctionUtils.compose((UnivariateDifferentiableFunction) g,
(UnivariateDifferentiableFunction) f);
@ -179,7 +178,7 @@ public class LogitTest {
final double hi = 3;
final Logit f = new Logit(lo, hi);
final Sigmoid g = new Sigmoid(lo, hi);
final UniformRandomProvider random = RandomSource.create(RandomSource.WELL_1024_A);
final UniformRandomProvider random = RandomSource.WELL_1024_A.create();
final UnivariateDifferentiableFunction id =
FunctionUtils.compose((UnivariateDifferentiableFunction) g, (UnivariateDifferentiableFunction) f);
for (int maxOrder = 0; maxOrder < 6; ++maxOrder) {

View File

@ -218,7 +218,7 @@ public class AkimaSplineInterpolatorTest {
assertTrue( Precision.equals( expected, actual ) );
}
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L); // "tol" depends on the seed.
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1234567L); // "tol" depends on the seed.
final ContinuousDistribution.Sampler distX =
new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);

View File

@ -359,7 +359,7 @@ public final class BicubicInterpolatingFunctionTest {
}
}
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1234567L);
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);

View File

@ -146,7 +146,7 @@ public final class BicubicInterpolatorTest {
final BicubicInterpolator interpolator = new BicubicInterpolator();
final BicubicInterpolatingFunction p = interpolator.interpolate(xval, yval, zval);
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C);
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create();
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);

View File

@ -251,7 +251,7 @@ public final class PiecewiseBicubicSplineInterpolatingFunctionTest {
}
}
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1234567L);
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);

View File

@ -159,7 +159,7 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
double x;
double y;
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1234567L);
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);
@ -212,7 +212,7 @@ public final class PiecewiseBicubicSplineInterpolatorTest {
double x;
double y;
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234567L);
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1234567L);
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xval[0], xval[xval.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yval[0], yval[yval.length - 1]).createSampler(rng);

View File

@ -380,7 +380,7 @@ public final class TricubicInterpolatingFunctionTest {
}
}
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_19937_C, 1234568L);
final UniformRandomProvider rng = RandomSource.WELL_19937_C.create(1234568L);
final ContinuousDistribution.Sampler distX = new UniformContinuousDistribution(xValues[0], xValues[xValues.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distY = new UniformContinuousDistribution(yValues[0], yValues[yValues.length - 1]).createSampler(rng);
final ContinuousDistribution.Sampler distZ = new UniformContinuousDistribution(zValues[0], zValues[zValues.length - 1]).createSampler(rng);

View File

@ -32,7 +32,7 @@ import org.apache.commons.math4.legacy.core.jdkmath.AccurateMath;
* Test for {@link UnivariatePeriodicInterpolator}.
*/
public class UnivariatePeriodicInterpolatorTest {
private final UniformRandomProvider rng = RandomSource.create(RandomSource.KISS);
private final UniformRandomProvider rng = RandomSource.KISS.create();
@Test
public void testSine() {

View File

@ -157,7 +157,7 @@ public class EnumeratedIntegerDistributionTest {
public void testSample() {
final int n = 1000000;
final DiscreteDistribution.Sampler sampler
= testDistribution.createSampler(RandomSource.create(RandomSource.WELL_19937_C));
= testDistribution.createSampler(RandomSource.WELL_19937_C.create());
final int[] samples = AbstractIntegerDistribution.sample(n, sampler);
Assert.assertEquals(n, samples.length);
double sum = 0;

View File

@ -177,7 +177,7 @@ public class EnumeratedRealDistributionTest {
public void testSample() {
final int n = 1000000;
final ContinuousDistribution.Sampler sampler =
testDistribution.createSampler(RandomSource.create(RandomSource.WELL_1024_A, -123456789));
testDistribution.createSampler(RandomSource.WELL_1024_A.create(-123456789));
final double[] samples = AbstractRealDistribution.sample(n, sampler);
Assert.assertEquals(n, samples.length);
double sum = 0;
@ -197,7 +197,7 @@ public class EnumeratedRealDistributionTest {
List<Pair<Object,Double>> list = new ArrayList<>();
list.add(new Pair<Object, Double>(new Object() {}, new Double(0)));
list.add(new Pair<Object, Double>(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);
}

View File

@ -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++) {

View File

@ -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;

View File

@ -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);

View File

@ -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};

View File

@ -393,7 +393,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFaFa() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xfafaL);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xfafaL);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 10);
double[] bD = generateDouble(r, 10);
@ -406,7 +406,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDaFa() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdafaL);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdafaL);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 10);
double[] bD = generateDouble(r, 10);
@ -418,7 +418,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFF2() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xff2L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xff2L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 2);
double[] bD = generateDouble(r, 2);
@ -433,7 +433,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDF2() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdf2L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdf2L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 2);
double[] bD = generateDouble(r, 2);
@ -447,7 +447,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFF3() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xff3L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xff3L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 3);
double[] bD = generateDouble(r, 3);
@ -463,7 +463,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDF3() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdf3L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdf3L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 3);
double[] bD = generateDouble(r, 3);
@ -478,7 +478,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationFF4() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xff4L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xff4L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 4);
double[] bD = generateDouble(r, 4);
@ -495,7 +495,7 @@ public abstract class ExtendedFieldElementAbstractTest<T extends RealFieldElemen
@Test
public void testLinearCombinationDF4() {
UniformRandomProvider r = RandomSource.create(RandomSource.WELL_1024_A, 0xdf4L);
UniformRandomProvider r = RandomSource.WELL_1024_A.create(0xdf4L);
for (int i = 0; i < 50; ++i) {
double[] aD = generateDouble(r, 4);
double[] bD = generateDouble(r, 4);

View File

@ -451,7 +451,7 @@ public class KalmanFilterTest {
*/
private ContinuousSampler createGaussianSampler(double mu,
double sigma) {
return GaussianSampler.of(ZigguratNormalizedGaussianSampler.of(RandomSource.create(RandomSource.JSF_64)),
return GaussianSampler.of(ZigguratNormalizedGaussianSampler.of(RandomSource.JSF_64.create()),
mu, sigma);
}
}

View File

@ -35,8 +35,7 @@ public class PolynomialCurveFitterTest {
@Test
public void testFit() {
final ContinuousDistribution.Sampler rng
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
64925784252L));
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.WELL_512_A.create(64925784252L));
final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
final PolynomialFunction f = new PolynomialFunction(coeff);

View File

@ -34,8 +34,7 @@ public class SimpleCurveFitterTest {
public void testPolynomialFit() {
final Random randomizer = new Random(53882150042L);
final ContinuousDistribution.Sampler rng
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.create(RandomSource.WELL_512_A,
64925784253L));
= new UniformContinuousDistribution(-100, 100).createSampler(RandomSource.WELL_512_A.create(64925784253L));
final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
final PolynomialFunction f = new PolynomialFunction(coeff);

View File

@ -49,7 +49,7 @@ public class RandomCirclePointGenerator {
double radius,
double xSigma,
double ySigma) {
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_44497_B);
final UniformRandomProvider rng = RandomSource.WELL_44497_B.create();
this.radius = radius;
cX = new NormalDistribution(x, xSigma).createSampler(rng);
cY = new NormalDistribution(y, ySigma).createSampler(rng);

View File

@ -61,7 +61,7 @@ public class RandomStraightLinePointGenerator {
double lo,
double hi,
long seed) {
final UniformRandomProvider rng = RandomSource.create(RandomSource.WELL_44497_B, seed);
final UniformRandomProvider rng = RandomSource.WELL_44497_B.create(seed);
slope = a;
intercept = b;
error = new NormalDistribution(0, sigma).createSampler(rng);

View File

@ -464,8 +464,7 @@ public class EigenDecompositionTest {
for (int run = 0; run < 100; run++) {
Random r = new Random(System.currentTimeMillis());
ContinuousDistribution.Sampler dist
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
64925784252L));
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.WELL_512_A.create(64925784252L));
// matrix size
int size = r.nextInt(20) + 4;

View File

@ -111,8 +111,7 @@ public class HessenbergTransformerTest {
for (int run = 0; run < 100; run++) {
Random r = new Random(System.currentTimeMillis());
ContinuousDistribution.Sampler dist
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
64925784252L));
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.WELL_512_A.create(64925784252L));
// matrix size
int size = r.nextInt(20) + 4;

View File

@ -115,8 +115,7 @@ public class SchurTransformerTest {
for (int run = 0; run < 100; run++) {
Random r = new Random(System.currentTimeMillis());
ContinuousDistribution.Sampler dist
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.create(RandomSource.WELL_512_A,
64925784252L));
= new NormalDistribution(0.0, r.nextDouble() * 5).createSampler(RandomSource.WELL_512_A.create(64925784252L));
// matrix size
int size = r.nextInt(20) + 4;

View File

@ -93,7 +93,7 @@ public class FuzzyKMeansClustererTest {
@Test
public void testGetters() {
final DistanceMeasure measure = new CanberraDistance();
final UniformRandomProvider random = RandomSource.create(RandomSource.MT_64);
final UniformRandomProvider random = RandomSource.MT_64.create();
final FuzzyKMeansClusterer<DoublePoint> clusterer =
new FuzzyKMeansClusterer<>(3, 2.0, 100, measure, 1e-6, random);

View File

@ -36,7 +36,7 @@ public class KMeansPlusPlusClustererTest {
@Before
public void setUp() {
random = RandomSource.create(RandomSource.MT_64, 1746432956321L);
random = RandomSource.MT_64.create(1746432956321L);
}
/**

View File

@ -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<DoublePoint> data = generateCircles(rng);
KMeansPlusPlusClusterer<DoublePoint> kMeans =
new KMeansPlusPlusClusterer<>(4, -1, DEFAULT_MEASURE, rng);

View File

@ -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<DoublePoint> 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<DoublePoint> points = new ArrayList<>();
for (double[] p : dataFromSkLearn) {
points.add(new DoublePoint(p));

View File

@ -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) });

View File

@ -52,7 +52,7 @@ public class MultiStartMultivariateOptimizerTest {
new SimpleValueChecker(1e-10, 1e-10));
final Supplier<double[]> 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<double[]> 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);

View File

@ -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),

View File

@ -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 {

View File

@ -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 {

View File

@ -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<double[]> 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,

View File

@ -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) {

View File

@ -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.

View File

@ -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;

View File

@ -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();

View File

@ -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();

View File

@ -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<Double> valuesList = new ArrayList<>();
for (int i = 0; i < len; i++) {
double value = valueDist.sample();

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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 };

View File

@ -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

View File

@ -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.

View File

@ -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};

View File

@ -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

View File

@ -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);
/*

View File

@ -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

View File

@ -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)

View File

@ -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);
/*

View File

@ -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.

View File

@ -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.