@Override
  public int nextInt(int max) {
    if (max == Integer.MAX_VALUE) {
      max--;
    }

    int theNext = nextInt();
    // Math.abs behaves badly when given min int, so avoid
    if (theNext == Integer.MIN_VALUE) {
      theNext = Integer.MIN_VALUE + 1;
    }
    return Math.abs(theNext) % (max + 1);
  }
Returns the next pseudorandom, uniformly distributed {@code int} value from this random number
generator's sequence within a range from 0 to max (inclusive -- which is different from
{@link Random#nextInt(int)}).

@param max the maximum range (inclusive) for the pseudorandom.
@return the next pseudorandom, uniformly distributed {@code int} value from this random number
        generator's sequence.
geode-junit/src/main/java/org/apache/geode/test/junit/rules/RandomRule.java