You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2016/05/17 15:49:39 UTC

[06/25] [math] MATH-1335

MATH-1335

Use new RNG API.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/6fc152e4
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/6fc152e4
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/6fc152e4

Branch: refs/heads/develop
Commit: 6fc152e4177e0482450b13eb7fe496de677ce5b6
Parents: f81e046
Author: Gilles <er...@apache.org>
Authored: Wed May 11 13:38:37 2016 +0200
Committer: Gilles <er...@apache.org>
Committed: Tue May 17 15:30:23 2016 +0200

----------------------------------------------------------------------
 .../org/apache/commons/math4/util/RandomPivotingStrategy.java  | 6 +++---
 .../commons/math4/stat/descriptive/rank/PercentileTest.java    | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/6fc152e4/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
----------------------------------------------------------------------
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 e386664..a13b566 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;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/6fc152e4/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
----------------------------------------------------------------------
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 98b6f91..ffac6cc 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();