[jdk17] RFR: JDK-8266313 (JEP-356) - RandomGenerator spec implementation requirements tightly coupled to JDK internal classes
Roger Riggs
rriggs at openjdk.java.net
Mon Jun 28 15:32:05 UTC 2021
On Fri, 25 Jun 2021 18:53:59 GMT, Jim Laskey <jlaskey at openjdk.org> 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
More information about the core-libs-dev
mailing list