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

Jim Laskey jlaskey at openjdk.java.net
Wed Nov 25 14:04:08 UTC 2020


On Wed, 25 Nov 2020 13:31:52 GMT, Rémi Forax <github.com+828220+forax at openjdk.org> wrote:

>> 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/RandomGenerator.java line 745:
> 
>> 743:      * if the period is unknown.
>> 744:      */
>> 745:     BigInteger UNKNOWN_PERIOD = BigInteger.ZERO;
> 
> move those 3 values into RandomGeneratorFactory ?

Will ponder on this one. I tend to agree with you since they are most likely to be used for filtering factories RandomGeneratorFactory querying was a later development. period() originally was a RandomGenerator query, but got moved when more queries were added. This will require a CSR and will come later.

> src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java line 444:
> 
>> 442:     }
>> 443: 
>> 444:     private static final AbstractSpliteratorGenerator proxy = new ThreadLocalRandomProxy();
> 
> should be declared inside ThreadLocalRandomProxy, so the value is only initialized when proxy() is called

agree

> src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java line 453:
> 
>> 451:      * @return a {@code RandomGenerator} object that uses {@code ThreadLocalRandom}
>> 452:      */
>> 453:     public static RandomGenerator proxy() {
> 
> proxy is a generic name, is there a better name here ?

will investigate

> src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java line 459:
> 
>> 457:     // Methods required by class AbstractSpliteratorGenerator
>> 458:     public Spliterator.OfInt makeIntsSpliterator(long index, long fence, int origin, int bound) {
>> 459:         return new RandomIntsSpliterator(proxy, index, fence, origin, bound);
> 
> should use proxy()

will investigate

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

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


More information about the security-dev mailing list