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/b7204813
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/b7204813
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/b7204813

Branch: refs/heads/develop
Commit: b720481312289d9fb311caeb4593c10561af317d
Parents: ae7ade3
Author: Gilles <er...@apache.org>
Authored: Thu May 12 14:04:19 2016 +0200
Committer: Gilles <er...@apache.org>
Committed: Tue May 17 15:30:23 2016 +0200

----------------------------------------------------------------------
 .../math4/geometry/enclosing/WelzlEncloser2DTest.java        | 6 +++---
 .../math4/geometry/euclidean/threed/FieldVector3DTest.java   | 7 ++++---
 .../math4/geometry/euclidean/threed/PolyhedronsSetTest.java  | 6 +++---
 .../math4/geometry/euclidean/threed/Vector3DTest.java        | 7 ++++---
 .../twod/hull/ConvexHullGenerator2DAbstractTest.java         | 8 ++++----
 5 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/b7204813/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
 
b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
index 3729574..2d39da5 100644
--- 
a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
+++ 
b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
@@ -25,8 +25,8 @@ import 
org.apache.commons.math4.geometry.enclosing.WelzlEncloser;
 import org.apache.commons.math4.geometry.euclidean.twod.DiskGenerator;
 import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
 import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math4.random.RandomGenerator;
-import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.rng.UniformRandomProvider;
+import org.apache.commons.math4.rng.RandomSource;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -84,7 +84,7 @@ public class WelzlEncloser2DTest {
 
     @Test
     public void testLargeSamples() {
-        RandomGenerator random = new Well1024a(0xa2a63cad12c01fb2l);
+        UniformRandomProvider random = 
RandomSource.create(RandomSource.WELL_1024_A, 0xa2a63cad12c01fb2l);
         for (int k = 0; k < 100; ++k) {
             int nbPoints = random.nextInt(10000);
             List<Vector2D> points = new ArrayList<Vector2D>();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b7204813/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
index 24e5515..2cf235f 100644
--- 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
+++ 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
@@ -27,7 +27,8 @@ import 
org.apache.commons.math4.exception.DimensionMismatchException;
 import org.apache.commons.math4.exception.MathArithmeticException;
 import org.apache.commons.math4.geometry.euclidean.threed.FieldVector3D;
 import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.rng.UniformRandomProvider;
+import org.apache.commons.math4.rng.RandomSource;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
@@ -592,7 +593,7 @@ public class FieldVector3DTest {
     public void testDotProduct() {
         // we compare accurate versus naive dot product implementations
         // on regular vectors (i.e. not extreme cases like in the previous 
test)
-        Well1024a random = new Well1024a(553267312521321234l);
+        UniformRandomProvider random = 
RandomSource.create(RandomSource.WELL_1024_A, 553267312521321237l);
         for (int i = 0; i < 10000; ++i) {
             double ux = 10000 * random.nextDouble();
             double uy = 10000 * random.nextDouble();
@@ -649,7 +650,7 @@ public class FieldVector3DTest {
     public void testCrossProduct() {
         // we compare accurate versus naive cross product implementations
         // on regular vectors (i.e. not extreme cases like in the previous 
test)
-        Well1024a random = new Well1024a(885362227452043214l);
+        UniformRandomProvider random = 
RandomSource.create(RandomSource.WELL_1024_A, 885362227452043214l);
         for (int i = 0; i < 10000; ++i) {
             double ux = random.nextDouble();
             double uy = random.nextDouble();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b7204813/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
index b1b902a..c0aaa13 100644
--- 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
+++ 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
@@ -50,8 +50,8 @@ import 
org.apache.commons.math4.geometry.partitioning.RegionDumper;
 import org.apache.commons.math4.geometry.partitioning.RegionFactory;
 import org.apache.commons.math4.geometry.partitioning.RegionParser;
 import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math4.random.RandomGenerator;
-import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.rng.UniformRandomProvider;
+import org.apache.commons.math4.rng.RandomSource;
 import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -440,7 +440,7 @@ public class PolyhedronsSetTest {
     public void testIssue1211() throws IOException, ParseException {
 
         PolyhedronsSet polyset = 
RegionParser.parsePolyhedronsSet(loadTestData("issue-1211.bsp"));
-        RandomGenerator random = new Well1024a(0xb97c9d1ade21e40al);
+        UniformRandomProvider random = 
RandomSource.create(RandomSource.WELL_1024_A, 0xb97c9d1ade21e40al);
         int nrays = 1000;
         for (int i = 0; i < nrays; i++) {
             Vector3D origin    = Vector3D.ZERO;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b7204813/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
index 41b0e3a..f9bf79b 100644
--- 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
+++ 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
@@ -28,7 +28,8 @@ import 
org.apache.commons.math4.exception.MathArithmeticException;
 import org.apache.commons.math4.geometry.Space;
 import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
 import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.rng.UniformRandomProvider;
+import org.apache.commons.math4.rng.RandomSource;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
@@ -350,7 +351,7 @@ public class Vector3DTest {
     public void testDotProduct() {
         // we compare accurate versus naive dot product implementations
         // on regular vectors (i.e. not extreme cases like in the previous 
test)
-        Well1024a random = new Well1024a(553267312521321234l);
+        UniformRandomProvider random = 
RandomSource.create(RandomSource.WELL_1024_A, 553267312521321237l);
         for (int i = 0; i < 10000; ++i) {
             double ux = 10000 * random.nextDouble();
             double uy = 10000 * random.nextDouble();
@@ -392,7 +393,7 @@ public class Vector3DTest {
     public void testCrossProduct() {
         // we compare accurate versus naive cross product implementations
         // on regular vectors (i.e. not extreme cases like in the previous 
test)
-        Well1024a random = new Well1024a(885362227452043214l);
+        UniformRandomProvider random = 
RandomSource.create(RandomSource.WELL_1024_A, 885362227452043215l);
         for (int i = 0; i < 10000; ++i) {
             double ux = 10000 * random.nextDouble();
             double uy = 10000 * random.nextDouble();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/b7204813/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
index 717b264..ea32b9c 100644
--- 
a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
+++ 
b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
@@ -29,8 +29,8 @@ import 
org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHull2D;
 import 
org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHullGenerator2D;
 import org.apache.commons.math4.geometry.partitioning.Region;
 import org.apache.commons.math4.geometry.partitioning.Region.Location;
-import org.apache.commons.math4.random.MersenneTwister;
-import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.rng.UniformRandomProvider;
+import org.apache.commons.math4.rng.RandomSource;
 import org.apache.commons.math4.util.FastMath;
 import org.apache.commons.math4.util.MathArrays;
 import org.apache.commons.math4.util.Precision;
@@ -45,7 +45,7 @@ import org.junit.Test;
 public abstract class ConvexHullGenerator2DAbstractTest {
 
     protected ConvexHullGenerator2D generator;
-    protected RandomGenerator random;
+    protected UniformRandomProvider random;
 
     protected abstract ConvexHullGenerator2D createConvexHullGenerator(boolean 
includeCollinearPoints);
 
@@ -58,7 +58,7 @@ public abstract class ConvexHullGenerator2DAbstractTest {
     public void setUp() {
         // by default, do not include collinear points
         generator = createConvexHullGenerator(false);
-        random = new MersenneTwister(10);
+        random = RandomSource.create(RandomSource.MT, 10);
     }
 
     // 
------------------------------------------------------------------------------

Reply via email to