From 6fc152e4177e0482450b13eb7fe496de677ce5b6 Mon Sep 17 00:00:00 2001 From: Gilles Date: Wed, 11 May 2016 13:38:37 +0200 Subject: [PATCH] MATH-1335 Use new RNG API. --- .../apache/commons/math4/util/RandomPivotingStrategy.java | 6 +++--- .../commons/math4/stat/descriptive/rank/PercentileTest.java | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java b/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java index e3866645e..a13b566cf 100644 --- a/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java +++ b/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java @@ -19,7 +19,7 @@ package org.apache.commons.math4.util; import java.io.Serializable; import org.apache.commons.math4.exception.MathIllegalArgumentException; -import org.apache.commons.math4.random.RandomGenerator; +import org.apache.commons.math4.rng.UniformRandomProvider; /** @@ -32,12 +32,12 @@ public class RandomPivotingStrategy implements PivotingStrategyInterface, Serial private static final long serialVersionUID = 20140713L; /** Random generator to use for selecting pivot. */ - private final RandomGenerator random; + private final UniformRandomProvider random; /** Simple constructor. * @param random random generator to use for selecting pivot */ - public RandomPivotingStrategy(final RandomGenerator random) { + public RandomPivotingStrategy(final UniformRandomProvider random) { this.random = random; } diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java index 98b6f913d..ffac6cc04 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java @@ -25,7 +25,6 @@ import org.apache.commons.math4.exception.MathIllegalArgumentException; import org.apache.commons.math4.exception.NotANumberException; import org.apache.commons.math4.exception.NullArgumentException; import org.apache.commons.math4.exception.OutOfRangeException; -import org.apache.commons.math4.random.Well1024a; import org.apache.commons.math4.rng.RandomSource; import org.apache.commons.math4.rng.UniformRandomProvider; import org.apache.commons.math4.stat.descriptive.UnivariateStatistic; @@ -317,7 +316,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{ @Test public void testAllTechniquesPercentileUsingRandomPivoting() { - kthSelector = new KthSelector(new RandomPivotingStrategy(new Well1024a(0x268a7fb4194240f6l))); + kthSelector = new KthSelector(new RandomPivotingStrategy(RandomSource.create(RandomSource.WELL_1024_A, 0x268a7fb4194240f6l))); Assert.assertEquals(RandomPivotingStrategy.class, getUnivariateStatistic().getPivotingStrategy().getClass()); checkAllTechniquesPercentile(); @@ -696,7 +695,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{ for (final PivotingStrategyInterface strategy : new PivotingStrategyInterface[] { new MedianOf3PivotingStrategy(), new CentralPivotingStrategy(), - new RandomPivotingStrategy(new Well1024a(0xf097c734e4740053l)) + new RandomPivotingStrategy(RandomSource.create(RandomSource.WELL_1024_A, 0xf097c734e4740053l)) }) { kthSelector = new KthSelector(strategy); testAllEstimationTechniquesOnly();