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 2019/11/28 17:15:04 UTC

[commons-rng] branch master updated (8889ad5 -> ae566a3)

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 8889ad5  Fix javadoc spacing after </sup> tag.
     new f43200e  [RNG-126] PoissonSamplerCache to return a SharedStateDiscreteSampler.
     new 66fa4c5  Use final.
     new ac2ed71  Use same seed for the two identical random sources in the test.
     new ae566a3  Correct indentation

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:
 .../PoissonSamplerCachePerformance.java            |  4 +-
 .../sampling/distribution/PoissonSamplerCache.java | 22 ++++++-
 .../distribution/ContinuousSamplersList.java       |  4 +-
 .../distribution/DiscreteSamplersList.java         |  2 +-
 .../distribution/PoissonSamplerCacheTest.java      | 69 ++++++++++++----------
 src/changes/changes.xml                            |  3 +
 6 files changed, 68 insertions(+), 36 deletions(-)


[commons-rng] 02/04: Use final.

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 66fa4c583401cb640e4542a887e6d89685e57b24
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Nov 28 17:03:23 2019 +0000

    Use final.
---
 .../distribution/PoissonSamplerCacheTest.java      | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
index 7be442d..87979e2 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
@@ -58,7 +58,7 @@ public class PoissonSamplerCacheTest {
     public void testConstructorWithNoCache() {
         final double min = 0;
         final double max = PoissonSampler.PIVOT - 2;
-        PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
         Assert.assertFalse(cache.isValidRange());
         Assert.assertEquals(0, cache.getMinMean(), 0);
         Assert.assertEquals(0, cache.getMaxMean(), 0);
@@ -73,7 +73,7 @@ public class PoissonSamplerCacheTest {
     public void testConstructorWhenMaxEqualsMin() {
         final double min = PoissonSampler.PIVOT + 2;
         final double max = min;
-        PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(min, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -89,7 +89,7 @@ public class PoissonSamplerCacheTest {
     public void testConstructorWhenMaxAboveMin() {
         final double min = PoissonSampler.PIVOT + 2;
         final double max = min + 10;
-        PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(min, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -114,7 +114,7 @@ public class PoissonSamplerCacheTest {
     public void testConstructorWhenMinBelow0() {
         final double min = -1;
         final double max = PoissonSampler.PIVOT + 2;
-        PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(PoissonSampler.PIVOT, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -129,7 +129,7 @@ public class PoissonSamplerCacheTest {
     public void testConstructorWhenMaxBelow0() {
         final double min = -10;
         final double max = -1;
-        PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
         Assert.assertFalse(cache.isValidRange());
         Assert.assertEquals(0, cache.getMinMean(), 0);
         Assert.assertEquals(0, cache.getMaxMean(), 0);
@@ -144,7 +144,7 @@ public class PoissonSamplerCacheTest {
     public void testWithRangeConstructorWithNoCache() {
         final double min = 0;
         final double max = PoissonSampler.PIVOT - 2;
-        PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
         Assert.assertFalse(cache.isValidRange());
         Assert.assertEquals(0, cache.getMinMean(), 0);
         Assert.assertEquals(0, cache.getMaxMean(), 0);
@@ -159,7 +159,7 @@ public class PoissonSamplerCacheTest {
     public void testWithRangeConstructorWhenMaxEqualsMin() {
         final double min = PoissonSampler.PIVOT + 2;
         final double max = min;
-        PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(min, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -175,7 +175,7 @@ public class PoissonSamplerCacheTest {
     public void testWithRangeConstructorWhenMaxAboveMin() {
         final double min = PoissonSampler.PIVOT + 2;
         final double max = min + 10;
-        PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(min, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -200,7 +200,7 @@ public class PoissonSamplerCacheTest {
     public void testWithRangeConstructorWhenMinBelow0() {
         final double min = -1;
         final double max = PoissonSampler.PIVOT + 2;
-        PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache().withRange(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(PoissonSampler.PIVOT, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -214,7 +214,7 @@ public class PoissonSamplerCacheTest {
     public void testWithRangeConstructorWhenCacheHasNoCapcity() {
         final double min = PoissonSampler.PIVOT + 2;
         final double max = min + 10;
-        PoissonSamplerCache cache = createPoissonSamplerCache(0, 0).withRange(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(0, 0).withRange(min, max);
         Assert.assertTrue(cache.isValidRange());
         Assert.assertEquals(min, cache.getMinMean(), 0);
         Assert.assertEquals(Math.nextAfter(Math.floor(max) + 1, -1),
@@ -229,7 +229,7 @@ public class PoissonSamplerCacheTest {
     public void testWithinRange() {
         final double min = PoissonSampler.PIVOT + 10;
         final double max = PoissonSampler.PIVOT + 20;
-        PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
+        final PoissonSamplerCache cache = createPoissonSamplerCache(min, max);
         // Under the pivot point is always within range
         Assert.assertTrue(cache.withinRange(PoissonSampler.PIVOT - 1));
         Assert.assertFalse(cache.withinRange(min - 1));


[commons-rng] 04/04: Correct indentation

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 ae566a3dbb6968e49149d65aa592fb502fa6c3e1
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Nov 28 17:11:38 2019 +0000

    Correct indentation
---
 .../commons/rng/sampling/distribution/ContinuousSamplersList.java     | 4 ++--
 .../commons/rng/sampling/distribution/DiscreteSamplersList.java       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
index 36d57ad..23efb8f 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
@@ -115,11 +115,11 @@ public final class ContinuousSamplersList {
             // Gamma (alpha < 1).
             add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(unusedRng, alphaGammaSmallerThanOne, thetaGamma),
                 AhrensDieterMarsagliaTsangGammaSampler.of(RandomSource.create(RandomSource.XOR_SHIFT_1024_S),
-                                                           alphaGammaSmallerThanOne, thetaGamma));
+                                                          alphaGammaSmallerThanOne, thetaGamma));
             // Gamma (alpha > 1).
             add(LIST, new org.apache.commons.math3.distribution.GammaDistribution(unusedRng, alphaGammaLargerThanOne, thetaGamma),
                 AhrensDieterMarsagliaTsangGammaSampler.of(RandomSource.create(RandomSource.WELL_44497_B),
-                                                           alphaGammaLargerThanOne, thetaGamma));
+                                                          alphaGammaLargerThanOne, thetaGamma));
 
             // Gumbel ("inverse method").
             final double muGumbel = -4.56;
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
index 7df26a0..873fbbc 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DiscreteSamplersList.java
@@ -183,7 +183,7 @@ public final class DiscreteSamplersList {
             add(LIST, discreteProbabilities,
                 GuideTableDiscreteSampler.of(RandomSource.create(RandomSource.XO_SHI_RO_512_SS), discreteProbabilities));
             add(LIST, discreteProbabilities,
-                    AliasMethodDiscreteSampler.of(RandomSource.create(RandomSource.KISS), discreteProbabilities));
+                AliasMethodDiscreteSampler.of(RandomSource.create(RandomSource.KISS), discreteProbabilities));
         } catch (Exception e) {
             // CHECKSTYLE: stop Regexp
             System.err.println("Unexpected exception while creating the list of samplers: " + e);


[commons-rng] 01/04: [RNG-126] PoissonSamplerCache to return a SharedStateDiscreteSampler.

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 f43200e36f70d8ea21a7ea9aeb39ee5f37d989f3
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Nov 28 17:02:39 2019 +0000

    [RNG-126] PoissonSamplerCache to return a SharedStateDiscreteSampler.
---
 .../PoissonSamplerCachePerformance.java            |  4 ++--
 .../sampling/distribution/PoissonSamplerCache.java | 22 ++++++++++++++++-
 .../distribution/PoissonSamplerCacheTest.java      | 28 +++++++++++++++-------
 src/changes/changes.xml                            |  3 +++
 4 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/sampling/distribution/PoissonSamplerCachePerformance.java b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/sampling/distribution/PoissonSamplerCachePerformance.java
index 80e4381..363157e 100644
--- a/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/sampling/distribution/PoissonSamplerCachePerformance.java
+++ b/commons-rng-examples/examples-jmh/src/main/java/org/apache/commons/rng/examples/jmh/sampling/distribution/PoissonSamplerCachePerformance.java
@@ -330,7 +330,7 @@ public class PoissonSamplerCachePerformance {
         final PoissonSamplerFactory factory = new PoissonSamplerFactory() {
             @Override
             public DiscreteSampler createPoissonSampler(double mean) {
-                return cache.createPoissonSampler(r, mean);
+                return cache.createSharedStateSampler(r, mean);
             }
         };
         runSample(factory, range, bh);
@@ -351,7 +351,7 @@ public class PoissonSamplerCachePerformance {
         final PoissonSamplerFactory factory = new PoissonSamplerFactory() {
             @Override
             public DiscreteSampler createPoissonSampler(double mean) {
-                return cache.createPoissonSampler(r, mean);
+                return cache.createSharedStateSampler(r, mean);
             }
         };
         runSample(factory, range, bh);
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCache.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCache.java
index a294783..1ee8f0f 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCache.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCache.java
@@ -151,9 +151,29 @@ public class PoissonSamplerCache {
      * @return A Poisson sampler
      * @throws IllegalArgumentException if {@code mean <= 0} or
      * {@code mean >} {@link Integer#MAX_VALUE}.
+     * @deprecated Use {@link #createSharedStateSampler(UniformRandomProvider, double)}.
      */
+    @Deprecated
     public DiscreteSampler createPoissonSampler(UniformRandomProvider rng,
                                                 double mean) {
+        return createSharedStateSampler(rng, mean);
+    }
+
+    /**
+     * Creates a new Poisson sampler.
+     *
+     * <p>The returned sampler will function exactly the
+     * same as {@link PoissonSampler#of(UniformRandomProvider, double)}.
+     *
+     * @param rng  Generator of uniformly distributed random numbers.
+     * @param mean Mean.
+     * @return A Poisson sampler
+     * @throws IllegalArgumentException if {@code mean <= 0} or
+     * {@code mean >} {@link Integer#MAX_VALUE}.
+     * @since 1.4
+     */
+    public SharedStateDiscreteSampler createSharedStateSampler(UniformRandomProvider rng,
+                                                               double mean) {
         // Ensure the same functionality as the PoissonSampler by
         // using a SmallMeanPoissonSampler under the switch point.
         if (mean < PoissonSampler.PIVOT) {
@@ -218,7 +238,7 @@ public class PoissonSamplerCache {
      * {@code false}.
      *
      * <p>The cache can still be used to create a {@link PoissonSampler} using
-     * {@link #createPoissonSampler(UniformRandomProvider, double)}.
+     * {@link #createSharedStateSampler(UniformRandomProvider, double)}.
      *
      * <p>This method can be used to determine if the cache has a potential
      * performance benefit.
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
index 54c6fbf..7be442d 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
@@ -241,28 +241,28 @@ public class PoissonSamplerCacheTest {
     // Edge cases for creating a Poisson sampler
 
     /**
-     * Test createPoissonSampler() with a bad mean.
+     * Test createSharedStateSampler() with a bad mean.
      *
      * <p>Note this test actually tests the SmallMeanPoissonSampler throws.
      */
     @Test(expected = IllegalArgumentException.class)
-    public void testCreatePoissonSamplerThrowsWithZeroMean() {
+    public void testCreateSharedStateSamplerThrowsWithZeroMean() {
         final RestorableUniformRandomProvider rng =
                 RandomSource.create(RandomSource.SPLIT_MIX_64);
         final PoissonSamplerCache cache = createPoissonSamplerCache();
-        cache.createPoissonSampler(rng, 0);
+        cache.createSharedStateSampler(rng, 0);
     }
 
     /**
-     * Test createPoissonSampler() with a mean that is too large.
+     * Test createSharedStateSampler() with a mean that is too large.
      */
     @Test(expected = IllegalArgumentException.class)
-    public void testCreatePoissonSamplerThrowsWithNonIntegerMean() {
+    public void testCreateSharedStateSamplerThrowsWithNonIntegerMean() {
         final RestorableUniformRandomProvider rng =
                 RandomSource.create(RandomSource.SPLIT_MIX_64);
         final PoissonSamplerCache cache = createPoissonSamplerCache();
         final double mean = Integer.MAX_VALUE + 1.0;
-        cache.createPoissonSampler(rng, mean);
+        cache.createSharedStateSampler(rng, mean);
     }
 
     // Sampling tests
@@ -385,7 +385,7 @@ public class PoissonSamplerCacheTest {
             PoissonSamplerCache cache,
             double mean) {
         final DiscreteSampler s1 = PoissonSampler.of(rng1, mean);
-        final DiscreteSampler s2 = cache.createPoissonSampler(rng2, mean);
+        final DiscreteSampler s2 = cache.createSharedStateSampler(rng2, mean);
         for (int j = 0; j < 10; j++) {
             Assert.assertEquals(s1.sample(), s2.sample());
         }
@@ -468,7 +468,7 @@ public class PoissonSamplerCacheTest {
         // Test all means in the test range (which may be different
         // from the cache range).
         for (int i = minMean; i <= maxMean; i++) {
-            cache.createPoissonSampler(rng1, i);
+            cache.createSharedStateSampler(rng1, i);
         }
 
         final PoissonSamplerCache cache2 = cache.withRange(minMean2, maxMean2);
@@ -486,4 +486,16 @@ public class PoissonSamplerCacheTest {
             testPoissonSamples(rng1, rng2, cache2, i + 0.5);
         }
     }
+
+    /**
+     * Explicit test for the deprecated method createPoissonSampler().
+     * All other uses of this method have been removed.
+     */
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testCreatePoissonSampler() {
+        final PoissonSamplerCache cache = createPoissonSamplerCache(0, 100);
+        final DiscreteSampler s2 = cache.createPoissonSampler(null, 42);
+        Assert.assertTrue(s2 instanceof LargeMeanPoissonSampler);
+    }
 }
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 26e54ed..fe0fe49 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,9 @@ re-run tests that fail, and pass the build if they succeed
 within the allotted number of reruns (the test will be marked
 as 'flaky' in the report).
 ">
+      <action dev="aherbert" type="add" issue="126">
+        "PoissonSamplerCache": Method to return a SharedStateDiscreteSampler.
+      </action>
       <action dev="aherbert" type="add" issue="124">
         Add fixed increment versions of the PCG generators.
       </action>


[commons-rng] 03/04: Use same seed for the two identical random sources in the 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 ac2ed711d67c3339560ded937bbc7a2f6d83304d
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Nov 28 17:08:10 2019 +0000

    Use same seed for the two identical random sources in the test.
---
 .../distribution/PoissonSamplerCacheTest.java         | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
index 87979e2..5f0d753 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/PoissonSamplerCacheTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.rng.sampling.distribution;
 
-import org.apache.commons.rng.RandomProviderState;
 import org.apache.commons.rng.RestorableUniformRandomProvider;
 import org.apache.commons.rng.simple.RandomSource;
 import org.junit.Assert;
@@ -327,12 +326,12 @@ public class PoissonSamplerCacheTest {
     private void checkComputeSameSamplesAsPoissonSampler(int minMean,
                                                          int maxMean) {
         // Two identical RNGs
+        final RandomSource source = RandomSource.SPLIT_MIX_64;
+        final long seed = RandomSource.createLong();
         final RestorableUniformRandomProvider rng1 =
-                RandomSource.create(RandomSource.WELL_19937_C);
-        final RandomProviderState state = rng1.saveState();
+                RandomSource.create(source, seed);
         final RestorableUniformRandomProvider rng2 =
-                RandomSource.create(RandomSource.WELL_19937_C);
-        rng2.restoreState(state);
+                RandomSource.create(source, seed);
 
         // Create the cache with the given range
         final PoissonSamplerCache cache =
@@ -456,11 +455,12 @@ public class PoissonSamplerCacheTest {
                                                                      int minMean2,
                                                                      int maxMean2) {
         // Two identical RNGs
+        final RandomSource source = RandomSource.SPLIT_MIX_64;
+        final long seed = RandomSource.createLong();
         final RestorableUniformRandomProvider rng1 =
-                RandomSource.create(RandomSource.WELL_19937_C);
-        final RandomProviderState state = rng1.saveState();
+                RandomSource.create(source, seed);
         final RestorableUniformRandomProvider rng2 =
-                RandomSource.create(RandomSource.WELL_19937_C);
+                RandomSource.create(source, seed);
 
         // Create the cache with the given range and fill it
         final PoissonSamplerCache cache =
@@ -474,9 +474,6 @@ public class PoissonSamplerCacheTest {
         final PoissonSamplerCache cache2 = cache.withRange(minMean2, maxMean2);
         Assert.assertTrue("WithRange cache is the same object", cache != cache2);
 
-        rng1.restoreState(state);
-        rng2.restoreState(state);
-
         // Test all means in the test range (which may be different
         // from the cache range).
         for (int i = minRange; i <= maxRange; i++) {