code: private static final int getR(final double theta, final double alpha, final double p) {
      final double split1 = (p * (alpha + 1.0)) / 2.0;
      if (theta > split1) { return 0; }
      if (theta > (alpha * split1)) { return 1; }
      return 2;
    }
docs: Computes whether there have been 0, 1, or 2 or more actual insertions into the cache in a
  numerically safe way.
  @param theta <a href="{@docRoot}/resources/dictionary.html#theta">See Theta</a>.
  @param alpha internal computed value alpha.
  @param p <a href="{@docRoot}/resources/dictionary.html#p">See Sampling Probability, <i>p</i></a>.
  @return R.