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 2015/12/28 18:23:25 UTC
[13/18] [math] MATH-1307
MATH-1307
Use new class.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/d8e2f892
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/d8e2f892
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/d8e2f892
Branch: refs/heads/master
Commit: d8e2f892e48423fda73204be3ec239d282e71c65
Parents: ca01fdf
Author: Gilles <er...@apache.org>
Authored: Mon Dec 28 17:55:00 2015 +0100
Committer: Gilles <er...@apache.org>
Committed: Mon Dec 28 17:55:00 2015 +0100
----------------------------------------------------------------------
.../distribution/ZipfDistributionTest.java | 37 ++++++++++++--------
1 file changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/d8e2f892/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
index eeae81f..1a71626 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
@@ -20,7 +20,7 @@ package org.apache.commons.math4.distribution;
import org.apache.commons.math4.TestUtils;
import org.apache.commons.math4.distribution.ZipfDistribution.ZipfRejectionInversionSampler;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
-import org.apache.commons.math4.random.AbstractRandomGenerator;
+import org.apache.commons.math4.random.BaseRandomGenerator;
import org.apache.commons.math4.random.RandomGenerator;
import org.apache.commons.math4.random.Well1024a;
import org.apache.commons.math4.util.FastMath;
@@ -215,20 +215,27 @@ public class ZipfDistributionTest extends IntegerDistributionAbstractTest {
long start = System.currentTimeMillis();
final int[] randomNumberCounter = new int[1];
- RandomGenerator randomGenerator = new AbstractRandomGenerator() {
-
- private final RandomGenerator r = new Well1024a(0L);
-
- @Override
- public void setSeed(long seed) {
- }
-
- @Override
- public double nextDouble() {
- randomNumberCounter[0]+=1;
- return r.nextDouble();
- }
- };
+ RandomGenerator randomGenerator = new BaseRandomGenerator() {
+ private final RandomGenerator r = new Well1024a(0L);
+
+ @Override
+ public void setSeed(long s) {
+ r.setSeed(s);
+ }
+ @Override
+ public void setSeed(int s) {
+ r.setSeed(s);
+ }
+ @Override
+ public void setSeed(int[] s) {
+ r.setSeed(s);
+ }
+ @Override
+ public int nextInt() {
+ randomNumberCounter[0] += 1;
+ return r.nextInt();
+ }
+ };
final ZipfDistribution distribution = new ZipfDistribution(randomGenerator, numPoints, exponent);
for (int i = 0; i < numGeneratedSamples; ++i) {