Replace deprecated calls.
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/InterpolatingMicrosphere.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/InterpolatingMicrosphere.java
index bb3ffab..79fc28a 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/InterpolatingMicrosphere.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/InterpolatingMicrosphere.java
@@ -132,7 +132,7 @@
// Generate the microsphere normals, assuming that a number of
// randomly generated normals will represent a sphere.
for (int i = 0; i < size; i++) {
- add(rand.nextVector(), false);
+ add(rand.sample(), false);
}
}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/MicrosphereProjectionInterpolator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/MicrosphereProjectionInterpolator.java
index d656ac6..9a0c7d0 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/MicrosphereProjectionInterpolator.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/MicrosphereProjectionInterpolator.java
@@ -84,7 +84,7 @@
darkThreshold,
background,
new UnitSphereSampler(dimension,
- RandomSource.create(RandomSource.MT_64))),
+ RandomSource.MT_64.create())),
exponent,
sharedSphere,
noInterpolationTolerance);
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/genetics/GeneticAlgorithm.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/genetics/GeneticAlgorithm.java
index 1745460..0d120aa 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/genetics/GeneticAlgorithm.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/genetics/GeneticAlgorithm.java
@@ -35,7 +35,7 @@
* alternative to the default PRNG, and/or select a specific seed.
*/
//@GuardedBy("this")
- private static UniformRandomProvider randomGenerator = RandomSource.create(RandomSource.WELL_19937_C);
+ private static UniformRandomProvider randomGenerator = RandomSource.WELL_19937_C.create();
/** the crossover policy used by the algorithm. */
private final CrossoverPolicy crossoverPolicy;
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/FuzzyKMeansClusterer.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/FuzzyKMeansClusterer.java
index 3eeb225..69c9712 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/FuzzyKMeansClusterer.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/FuzzyKMeansClusterer.java
@@ -118,7 +118,7 @@
*/
public FuzzyKMeansClusterer(final int k, final double fuzziness,
final int maxIterations, final DistanceMeasure measure) {
- this(k, fuzziness, maxIterations, measure, DEFAULT_EPSILON, RandomSource.create(RandomSource.MT_64));
+ this(k, fuzziness, maxIterations, measure, DEFAULT_EPSILON, RandomSource.MT_64.create());
}
/**
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClusterer.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClusterer.java
index eb9e1fc..9890194 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClusterer.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/clustering/KMeansPlusPlusClusterer.java
@@ -108,7 +108,7 @@
* @param measure the distance measure to use
*/
public KMeansPlusPlusClusterer(final int k, final int maxIterations, final DistanceMeasure measure) {
- this(k, maxIterations, measure, RandomSource.create(RandomSource.MT_64));
+ this(k, maxIterations, measure, RandomSource.MT_64.create());
}
/** Build a clusterer.
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/RandomPivotingStrategy.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/RandomPivotingStrategy.java
index 7415afd..bb91ba8 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/RandomPivotingStrategy.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/RandomPivotingStrategy.java
@@ -49,7 +49,7 @@
public RandomPivotingStrategy(RandomSource randomSource,
long seed) {
this.randomSource = randomSource;
- random = RandomSource.create(randomSource, seed);
+ random = randomSource.create(seed);
}
/**
@@ -92,7 +92,7 @@
in.defaultReadObject();
// Recreate the "delegate" from serialized info.
- random = RandomSource.create(randomSource);
+ random = randomSource.create();
// And restore its state.
final RandomProviderDefaultState state = new RandomProviderDefaultState((byte[]) in.readObject());
random.restoreState(state);
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTest.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTest.java
index 4dc003b..14ccc1a 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTest.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/inference/KolmogorovSmirnovTest.java
@@ -1082,7 +1082,7 @@
if (hasTies(x, y)) {
// Add jitter using a fixed seed (so same arguments always give same results),
// low-initialization-overhead generator.
- final UniformRandomProvider rng = RandomSource.create(RandomSource.SPLIT_MIX_64, 876543217L);
+ final UniformRandomProvider rng = RandomSource.SPLIT_MIX_64.create(876543217L);
// It is theoretically possible that jitter does not break ties, so repeat
// until all ties are gone. Bound the loop and throw MIE if bound is exceeded.
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRanking.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRanking.java
index bad04ca..49116c1 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRanking.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/ranking/NaturalRanking.java
@@ -102,7 +102,7 @@
public NaturalRanking(TiesStrategy tiesStrategy) {
this(DEFAULT_NAN_STRATEGY,
tiesStrategy,
- RandomSource.create(RandomSource.WELL_19937_C));
+ RandomSource.WELL_19937_C.create());
}
/**
@@ -124,7 +124,7 @@
TiesStrategy tiesStrategy) {
this(nanStrategy,
tiesStrategy,
- RandomSource.create(RandomSource.WELL_19937_C));
+ RandomSource.WELL_19937_C.create());
}
/**