You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2022/03/30 11:41:46 UTC

[commons-rng] branch master updated (ea379ad -> b070b42)

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git.


    from ea379ad  Consolidate Int/LongProvider to use next() as the source of random bits
     new 587a39b  Consistent error messages for nextInRange test
     new 498610f  Correct isUniformNextByte test
     new 3fb6b32  Update checkNextInRange to use a LongSupplier
     new b070b42  Support methods can be static

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../rng/core/ProvidersCommonParametricTest.java    | 127 ++++++++++-----------
 .../ContinuousSamplerParametricTest.java           |   6 +-
 .../rng/simple/ProvidersCommonParametricTest.java  |  51 +++++----
 3 files changed, 90 insertions(+), 94 deletions(-)

[commons-rng] 01/04: Consistent error messages for nextInRange test

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit 587a39b33c80832016e672e196ed4b3e248b22e3
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Mar 30 12:06:45 2022 +0100

    Consistent error messages for nextInRange test
    
    Port modifications from sampling ContinuousSamplerParametricTest to the
    ProvidersCommonParametricTest in core and simple modules.
    
    Updated the precision of the chi-square critical value.
    
    Add failed chi-square values to the message.
    
    Format failed chi-square values to 3 decimal places.
---
 .../rng/core/ProvidersCommonParametricTest.java    | 23 +++++++++++++++-------
 .../ContinuousSamplerParametricTest.java           |  6 ++++--
 .../rng/simple/ProvidersCommonParametricTest.java  | 22 +++++++++++++++------
 3 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
index 6935b90..4d3d3a0 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
@@ -20,7 +20,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.concurrent.Callable;
-
+import java.util.stream.Collectors;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -498,21 +498,25 @@ class ProvidersCommonParametricTest {
         final int[] observed = new int[numBins];
         // Chi-square critical value with 9 degrees of freedom
         // and 1% significance level.
-        final double chi2CriticalValue = 21.67;
+        final double chi2CriticalValue = 21.665994333461924;
 
+        // For storing chi2 larger than the critical value.
+        final List<Double> failedStat = new ArrayList<>();
         try {
+            final int lastDecileIndex = numBins - 1;
             for (int i = 0; i < numTests; i++) {
                 Arrays.fill(observed, 0);
-                for (int j = 0; j < sampleSize; j++) {
+                SAMPLE: for (int j = 0; j < sampleSize; j++) {
                     final long value = nextMethod.call().longValue();
                     Assertions.assertTrue(value >= 0 && value < n, "Range");
 
-                    for (int k = 0; k < numBins; k++) {
+                    for (int k = 0; k < lastDecileIndex; k++) {
                         if (value < binUpperBounds[k]) {
                             ++observed[k];
-                            break;
+                            continue SAMPLE;
                         }
                     }
+                    ++observed[lastDecileIndex];
                 }
 
                 // Compute chi-square.
@@ -524,6 +528,7 @@ class ProvidersCommonParametricTest {
 
                 // Statistics check.
                 if (chi2 > chi2CriticalValue) {
+                    failedStat.add(chi2);
                     ++numFailures;
                 }
             }
@@ -541,8 +546,12 @@ class ProvidersCommonParametricTest {
         // 12    0.00190
 
         if (numFailures > 11) { // Test will fail with 0.5% probability
-            Assertions.fail(generator + ": Too many failures for n = " + n +
-                            " (" + numFailures + " out of " + numTests + " tests failed)");
+            Assertions.fail(String.format(
+                "%s: Too many failures for n = %d, sample size = %d " +
+                "(%d out of %d tests failed, chi2 > %.3f=%s)",
+                generator, n, sampleSize, numFailures, numTests, chi2CriticalValue,
+                failedStat.stream().map(d -> String.format("%.3f", d))
+                          .collect(Collectors.joining(", ", "[", "]"))));
         }
     }
 
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
index baa528f..751210f 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplerParametricTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.rng.sampling.distribution;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 import java.util.ArrayList;
 
 import org.junit.jupiter.api.Assertions;
@@ -114,9 +115,10 @@ class ContinuousSamplerParametricTest {
         if (numFailures > 3) { // Test will fail with 0.16% probability
             Assertions.fail(String.format(
                     "%s: Too many failures for sample size = %d " +
-                    " (%d out of %d tests failed, chi2 > %.3f=%s)",
+                    "(%d out of %d tests failed, chi2 > %.3f=%s)",
                     sampler, sampleSize, numFailures, numTests, chi2CriticalValue,
-                    Arrays.toString(failedStat.toArray(new Double[0]))));
+                    failedStat.stream().map(d -> String.format("%.3f", d))
+                              .collect(Collectors.joining(", ", "[", "]"))));
         }
     }
 }
diff --git a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
index c4d95cc..55c6070 100644
--- a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
+++ b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
@@ -20,6 +20,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.concurrent.Callable;
+import java.util.stream.Collectors;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
@@ -440,21 +441,25 @@ class ProvidersCommonParametricTest {
         final int[] observed = new int[numBins];
         // Chi-square critical value with 9 degrees of freedom
         // and 1% significance level.
-        final double chi2CriticalValue = 21.67;
+        final double chi2CriticalValue = 21.665994333461924;
 
+        // For storing chi2 larger than the critical value.
+        final List<Double> failedStat = new ArrayList<>();
         try {
+            final int lastDecileIndex = numBins - 1;
             for (int i = 0; i < numTests; i++) {
                 Arrays.fill(observed, 0);
-                for (int j = 0; j < sampleSize; j++) {
+                SAMPLE: for (int j = 0; j < sampleSize; j++) {
                     final long value = nextMethod.call().longValue();
                     Assertions.assertTrue(value >= 0 && value < n, "Range");
 
-                    for (int k = 0; k < numBins; k++) {
+                    for (int k = 0; k < lastDecileIndex; k++) {
                         if (value < binUpperBounds[k]) {
                             ++observed[k];
-                            break;
+                            continue SAMPLE;
                         }
                     }
+                    ++observed[lastDecileIndex];
                 }
 
                 // Compute chi-square.
@@ -466,6 +471,7 @@ class ProvidersCommonParametricTest {
 
                 // Statistics check.
                 if (chi2 > chi2CriticalValue) {
+                    failedStat.add(chi2);
                     ++numFailures;
                 }
             }
@@ -483,8 +489,12 @@ class ProvidersCommonParametricTest {
         // 12    0.00190
 
         if (numFailures > 11) { // Test will fail with 0.5% probability
-            Assertions.fail(generator + ": Too many failures for n = " + n +
-                            " (" + numFailures + " out of " + numTests + " tests failed)");
+            Assertions.fail(String.format(
+                    "%s: Too many failures for n = %d, sample size = %d " +
+                    "(%d out of %d tests failed, chi2 > %.3f=%s)",
+                    generator, n, sampleSize, numFailures, numTests, chi2CriticalValue,
+                    failedStat.stream().map(d -> String.format("%.3f", d))
+                              .collect(Collectors.joining(", ", "[", "]"))));
         }
     }
 

[commons-rng] 03/04: Update checkNextInRange to use a LongSupplier

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit 3fb6b326b1889f2ddc01cb040e72d710b0f27ce1
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Mar 30 12:39:18 2022 +0100

    Update checkNextInRange to use a LongSupplier
    
    The generic type <T extends Number> was used as a long value. The type
    can be dropped to avoid auto-boxing for all generator tests.
    
    Modified methods to static.
---
 .../rng/core/ProvidersCommonParametricTest.java    | 62 ++++++++--------------
 .../rng/simple/ProvidersCommonParametricTest.java  | 29 +++++-----
 2 files changed, 33 insertions(+), 58 deletions(-)

diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
index 4c7b54c..653c878 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
@@ -20,6 +20,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.concurrent.Callable;
+import java.util.function.LongSupplier;
 import java.util.stream.Collectors;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -381,15 +382,10 @@ class ProvidersCommonParametricTest {
      * @param max Upper bound.
      * @param sampleSize Number of random values generated.
      */
-    private void checkNextIntegerInRange(final UniformRandomProvider generator,
-                                         final int max,
-                                         int sampleSize) {
-        final Callable<Integer> nextMethod = new Callable<Integer>() {
-            @Override
-            public Integer call() throws Exception {
-                return generator.nextInt(max);
-            }
-        };
+    private static void checkNextIntegerInRange(final UniformRandomProvider generator,
+                                                final int max,
+                                                int sampleSize) {
+        final LongSupplier nextMethod = () -> generator.nextInt(max);
 
         checkNextInRange(generator, max, sampleSize, nextMethod);
     }
@@ -401,15 +397,10 @@ class ProvidersCommonParametricTest {
      * @param max Upper bound.
      * @param sampleSize Number of random values generated.
      */
-    private void checkNextLongInRange(final UniformRandomProvider generator,
-                                      long max,
-                                      int sampleSize) {
-        final Callable<Long> nextMethod = new Callable<Long>() {
-            @Override
-            public Long call() throws Exception {
-                return generator.nextLong(max);
-            }
-        };
+    private static void checkNextLongInRange(final UniformRandomProvider generator,
+                                             long max,
+                                             int sampleSize) {
+        final LongSupplier nextMethod = () -> generator.nextLong(max);
 
         checkNextInRange(generator, max, sampleSize, nextMethod);
     }
@@ -420,15 +411,10 @@ class ProvidersCommonParametricTest {
      * @param generator Generator.
      * @param sampleSize Number of random values generated.
      */
-    private void checkNextFloat(final UniformRandomProvider generator,
-                                int sampleSize) {
+    private static void checkNextFloat(final UniformRandomProvider generator,
+                                       int sampleSize) {
         final int max = 1234;
-        final Callable<Integer> nextMethod = new Callable<Integer>() {
-            @Override
-            public Integer call() throws Exception {
-                return (int) (max * generator.nextFloat());
-            }
-        };
+        final LongSupplier nextMethod = () -> (int) (max * generator.nextFloat());
 
         checkNextInRange(generator, max, sampleSize, nextMethod);
     }
@@ -439,15 +425,10 @@ class ProvidersCommonParametricTest {
      * @param generator Generator.
      * @param sampleSize Number of random values generated.
      */
-    private void checkNextDouble(final UniformRandomProvider generator,
-                                 int sampleSize) {
+    private static void checkNextDouble(final UniformRandomProvider generator,
+                                        int sampleSize) {
         final int max = 578;
-        final Callable<Integer> nextMethod = new Callable<Integer>() {
-            @Override
-            public Integer call() throws Exception {
-                return (int) (max * generator.nextDouble());
-            }
-        };
+        final LongSupplier nextMethod = () -> (int) (max * generator.nextDouble());
 
         checkNextInRange(generator, max, sampleSize, nextMethod);
     }
@@ -461,21 +442,20 @@ class ProvidersCommonParametricTest {
      * tests is tested at the 0.5% significance level.
      *
      * @param generator Generator.
-     * @param max Upper bound.
+     * @param n Upper bound.
      * @param nextMethod method to call.
      * @param sampleSize Number of random values generated.
      */
-    private <T extends Number> void checkNextInRange(final UniformRandomProvider generator,
-                                                     T max,
-                                                     int sampleSize,
-                                                     Callable<T> nextMethod) {
+    private static void checkNextInRange(final UniformRandomProvider generator,
+                                         long n,
+                                         int sampleSize,
+                                         LongSupplier nextMethod) {
         final int numTests = 500;
 
         // Do not change (statistical test assumes that dof = 9).
         final int numBins = 10; // dof = numBins - 1
 
         // Set up bins.
-        final long n = max.longValue();
         final long[] binUpperBounds = new long[numBins];
         final double step = n / (double) numBins;
         for (int k = 0; k < numBins; k++) {
@@ -507,7 +487,7 @@ class ProvidersCommonParametricTest {
             for (int i = 0; i < numTests; i++) {
                 Arrays.fill(observed, 0);
                 SAMPLE: for (int j = 0; j < sampleSize; j++) {
-                    final long value = nextMethod.call().longValue();
+                    final long value = nextMethod.getAsLong();
                     Assertions.assertTrue(value >= 0 && value < n, "Range");
 
                     for (int k = 0; k < lastDecileIndex; k++) {
diff --git a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
index 55c6070..b9c6e4b 100644
--- a/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
+++ b/commons-rng-simple/src/test/java/org/apache/commons/rng/simple/ProvidersCommonParametricTest.java
@@ -20,6 +20,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.concurrent.Callable;
+import java.util.function.LongSupplier;
 import java.util.stream.Collectors;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
@@ -382,17 +383,12 @@ class ProvidersCommonParametricTest {
      * @param sampleSize Number of random values generated.
      * @param generator Random generator.
      */
-    private void checkNextIntegerInRange(final UniformRandomProvider rng,
-                                         final int max,
-                                         int sampleSize) {
-        final Callable<Integer> nextMethod = new Callable<Integer>() {
-            @Override
-            public Integer call() throws Exception {
-                return rng.nextInt(max);
-            }
-        };
+    private static void checkNextIntegerInRange(final UniformRandomProvider rng,
+                                                final int max,
+                                                int sampleSize) {
+        final LongSupplier nextMethod = () -> rng.nextInt(max);
 
-        checkNextInRange(max, sampleSize, nextMethod, rng);
+        checkNextInRange(rng, max, sampleSize, nextMethod);
     }
 
     /**
@@ -403,22 +399,21 @@ class ProvidersCommonParametricTest {
      * Repeat tests are performed at the 1% level and the total number of failed
      * tests is tested at the 0.5% significance level.
      *
-     * @param max Upper bound.
+     * @param n Upper bound.
      * @param nextMethod method to call.
      * @param sampleSize Number of random values generated.
      * @param generator Random generator.
      */
-    private static <T extends Number> void checkNextInRange(T max,
-                                                            int sampleSize,
-                                                            Callable<T> nextMethod,
-                                                            UniformRandomProvider generator) {
+    private static void checkNextInRange(UniformRandomProvider generator,
+                                         long n,
+                                         int sampleSize,
+                                         LongSupplier nextMethod) {
         final int numTests = 500;
 
         // Do not change (statistical test assumes that dof = 9).
         final int numBins = 10; // dof = numBins - 1
 
         // Set up bins.
-        final long n = max.longValue();
         final long[] binUpperBounds = new long[numBins];
         final double step = n / (double) numBins;
         for (int k = 0; k < numBins; k++) {
@@ -450,7 +445,7 @@ class ProvidersCommonParametricTest {
             for (int i = 0; i < numTests; i++) {
                 Arrays.fill(observed, 0);
                 SAMPLE: for (int j = 0; j < sampleSize; j++) {
-                    final long value = nextMethod.call().longValue();
+                    final long value = nextMethod.getAsLong();
                     Assertions.assertTrue(value >= 0 && value < n, "Range");
 
                     for (int k = 0; k < lastDecileIndex; k++) {

[commons-rng] 02/04: Correct isUniformNextByte test

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit 498610f60964b9b6bc63ef7721bf86120cc7d778
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Mar 30 12:26:24 2022 +0100

    Correct isUniformNextByte test
    
    Chi-square critical value should be for 255 degrees of freedom.
    
    This lowers the critical value from 311.56 to 310.46. The test is now
    harder to pass.
---
 .../rng/core/ProvidersCommonParametricTest.java    | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
index 4d3d3a0..4c7b54c 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
@@ -122,9 +122,13 @@ class ProvidersCommonParametricTest {
         // Test should pass for the part of the buffer where values are put.
         Assertions.assertTrue(isUniformNextBytes(buffer, offset, offset + size, nextMethod), generator::toString);
 
-        // Test must fail for the parts of the buffer where no values are put.
-        Assertions.assertFalse(isUniformNextBytes(buffer, 0, offset, nextMethod));
-        Assertions.assertFalse(isUniformNextBytes(buffer, offset + size, buffer.length, nextMethod));
+        // The parts of the buffer where no values are put should be zero.
+        for (int i = 0; i < offset; i++) {
+            Assertions.assertEquals(0, buffer[i], generator::toString);
+        }
+        for (int i = offset + size; i < totalSize; i++) {
+            Assertions.assertEquals(0, buffer[i], generator::toString);
+        }
     }
 
     @ParameterizedTest
@@ -299,27 +303,23 @@ class ProvidersCommonParametricTest {
 
         // Number of possible values (do not change).
         final int byteRange = 256;
-        // Chi-square critical value with 256 degrees of freedom
+        // Chi-square critical value with 255 degrees of freedom
         // and 1% significance level.
-        final double chi2CriticalValue = 311.560343;
-        // To transform a byte value into its bin index.
-        final int byteRangeOffset = 128;
+        final double chi2CriticalValue = 310.45738821990585;
 
         // Bins.
         final long[] observed = new long[byteRange];
         final double[] expected = new double[byteRange];
 
-        for (int i = 0; i < byteRange; i++) {
-            expected[i] = sampleSize * (last - first) / (double) byteRange;
-        }
+        Arrays.fill(expected, sampleSize * (last - first) / (double) byteRange);
 
         try {
             for (int k = 0; k < sampleSize; k++) {
                 nextMethod.run();
 
                 for (int i = first; i < last; i++) {
-                    final byte b = buffer[i];
-                    ++observed[b + byteRangeOffset];
+                    // Convert byte to an index in [0, 255]
+                    ++observed[buffer[i] & 0xff];
                 }
             }
         } catch (Exception e) {
@@ -335,7 +335,7 @@ class ProvidersCommonParametricTest {
         }
 
         // Statistics check.
-        return chi2 < chi2CriticalValue;
+        return chi2 <= chi2CriticalValue;
     }
 
     /**

[commons-rng] 04/04: Support methods can be static

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git

commit b070b4289b2a05fea88c4191e8dffe3d90d8a907
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Mar 30 12:40:01 2022 +0100

    Support methods can be static
---
 .../commons/rng/core/ProvidersCommonParametricTest.java  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
index 653c878..521ece7 100644
--- a/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
+++ b/commons-rng-core/src/test/java/org/apache/commons/rng/core/ProvidersCommonParametricTest.java
@@ -261,7 +261,7 @@ class ProvidersCommonParametricTest {
      * @param generator RNG under test.
      * @return a list containing {@code 11 * n} random numbers.
      */
-    private List<Number> makeList(int n, UniformRandomProvider generator) {
+    private static List<Number> makeList(int n, UniformRandomProvider generator) {
         final List<Number> list = new ArrayList<>();
 
         for (int i = 0; i < n; i++) {
@@ -296,10 +296,10 @@ class ProvidersCommonParametricTest {
      * @param nextMethod Method that fills the given {@code buffer}.
      * @return {@code true} if the distribution is uniform.
      */
-    private boolean isUniformNextBytes(byte[] buffer,
-                                       int first,
-                                       int last,
-                                       Runnable nextMethod) {
+    private static boolean isUniformNextBytes(byte[] buffer,
+                                              int first,
+                                              int last,
+                                              Runnable nextMethod) {
         final int sampleSize = 10000;
 
         // Number of possible values (do not change).
@@ -350,9 +350,9 @@ class ProvidersCommonParametricTest {
      * values are to be placed in the first bin, {@code false} if it must
      * go to the second bin.
      */
-    private void checkRandomWalk(UniformRandomProvider generator,
-                                 int sampleSize,
-                                 Callable<Boolean> nextMethod) {
+    private static void checkRandomWalk(UniformRandomProvider generator,
+                                        int sampleSize,
+                                        Callable<Boolean> nextMethod) {
         int walk = 0;
 
         try {