On Fri, 25 Jun 2021 18:53:59 GMT, Jim Laskey <[email protected]> wrote:
> The wording of the @implSpec referred to internal methods in the description.
> The patch rewords the @implSpec to be more descriptive of the algorithm than
> the methods used.
src/java.base/share/classes/java/util/random/RandomGenerator.java line 648:
> 646: * power of two then limiting is a simple masking operation.
> Otherwise, a
> 647: * new result is re-calculated by averaging the previous result and
> 648: * {@code nextInt()} until the final result is greater equal zero
> and less
I don't see how 'averaging' comes from the invocation of boundedNextInt which
appears to choose the first candidate that meets the criteria.
The comment also applies to nextLong overloads.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/151