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

Rémi Forax github.com+828220+forax at openjdk.java.net
Wed Nov 25 13:41:04 UTC 2020


On Wed, 25 Nov 2020 13:09:03 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> This PR is to introduce a new random number API for the JDK. The primary API is found in RandomGenerator and RandomGeneratorFactory. Further description can be found in the JEP https://openjdk.java.net/jeps/356 .
>> 
>> javadoc can be found at http://cr.openjdk.java.net/~jlaskey/prng/doc/api/java.base/java/util/random/package-summary.html
>> 
>> old PR:  https://github.com/openjdk/jdk/pull/1273
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8248862: Implement Enhanced Pseudo-Random Number Generators
>   
>   Changes to RandomGeneratorFactory requested by @PaulSandoz

src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 88:

> 86:  * <pre>{@code
> 87:  *     RandomGeneratorFactory<RandomGenerator> best = RandomGenerator.all()
> 88:  *         .sorted((f, g) -> Integer.compare(g.stateBits(), f.stateBits()))

use Comparator.comparingInt(RandomGenerator::stateBits) instead of the lambda

src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 116:

> 114:      * Map of properties for provider.
> 115:      */
> 116:     private volatile Map<RandomGeneratorProperty, Object> properties = null;

`= null` is useless here

src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 106:

> 104:      * Map of provider classes.
> 105:      */
> 106:     private static volatile Map<String, Provider<? extends RandomGenerator>> factoryMap;

should be FACTORY_MAP given that it's a static field

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

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


More information about the security-dev mailing list