RFR: 8248862: Implement Enhanced Pseudo-Random Number Generators [v25]

Jim Laskey jlaskey at openjdk.java.net
Mon Mar 1 13:59:53 UTC 2021


On Fri, 26 Feb 2021 21:32:12 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 57 commits:
>> 
>>  - Merge branch 'master' into 8248862
>>  - Adjust ThreadLocalRandom javadoc inheritence
>>  - L32X64StarStarRandom -> L32X64MixRandom
>>  - Various corrects
>>  - Revised javadoc per CSR reviews
>>  - Remove tabs from random/package-info.java
>>  - Correct copyright notice.
>>  - Merge branch 'master' into 8248862
>>  - Update tests for RandomGeneratorFactory.all()
>>  - Merge branch 'master' into 8248862
>>  - ... and 47 more: https://git.openjdk.java.net/jdk/compare/0257caad...b9094279
>
> src/java.base/share/classes/java/util/random/RandomGenerator.java line 1313:
> 
>> 1311:      * furthermore can easily <i>jump</i> to an arbitrarily specified distant
>> 1312:      * point in the state cycle.
>> 1313:      *
> 
> The similarity of the first sentence of each of the Jumpable, Leapable, and arbitrarlyJumpable interface is so similar as to obscure the differences. You have to read 25 words in to be able to find the description that makes them different. The italics help but should include the whole of the phrase that distinguishes them.
> Alternatively, move the phrase to the beginning of the sentence or drop the redundant phrasing.
> "provide a common protocol of objects that generate pseudorandom sequences of numbers of Boolean values", etc.

Jumpable:
     * This interface is designed to provide a common protocol for objects that
     * generate pseudorandom sequences of numbers (or Boolean values) and
     * furthermore can easily <i>jump</i> forward, by a moderate amount (ex.
     * 2<sup>64</sup>) to a distant point in the state cycle.

Leapable:
     * This interface is designed to provide a common protocol for objects that
     * generate sequences of pseudorandom numbers (or Boolean values) and
     * furthermore can easily not only jump but also
     * <i>leap</i> forward, by a large amount (ex. 2<sup>128</sup>), to a
     * very distant point in the state cycle.

ArbitrarilyJumpable:
     * This interface is designed to provide a common protocol for objects that
     * generate sequences of pseudorandom numbers (or Boolean values) and
     * furthermore can easily <i>jump</i> forward, by an arbitrary amount, to a
     * distant point in the state cycle.

> src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 55:
> 
>> 53:  *
>> 54:  * A specific {@link RandomGeneratorFactory} can be located by using the
>> 55:  * {@link RandomGenerator#factoryOf(String)} method, where the argument string
> 
> Broken link: the method is in this class.  should be just "#factoryOf".

Modified

> src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 600:
> 
>> 598:         try {
>> 599:             ensureConstructors();
>> 600:             return ctorBytes.newInstance((Object)seed);
> 
> IntelliJ warns that the cast to (Object) is redundant.

Modified

> src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 29:
> 
>> 27: 
>> 28: import java.lang.reflect.Constructor;
>> 29: import java.lang.reflect.Method;
> 
> Used import.

Modified

-------------

PR: https://git.openjdk.java.net/jdk/pull/1292


More information about the security-dev mailing list