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

Jim Laskey jlaskey at openjdk.java.net
Tue Feb 16 14:06:56 UTC 2021


On Sat, 13 Feb 2021 15:03:53 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Added table of available algorithms.
>
> src/java.base/share/classes/java/util/Random.java line 29:
> 
>> 27: 
>> 28: import java.io.*;
>> 29: import java.math.BigInteger;
> 
> This import is not actually used

good

> src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java line 115:
> 
>> 113:     static final String BAD_BOUND = "bound must be positive";
>> 114:     static final String BAD_FLOATING_BOUND = "bound must be finite and positive";
>> 115:     static final String BAD_RANGE = "bound must be greater than origin";
> 
> Unused fields in Random class now can be cleaned up: `java.util.Random#BadRange`, `java.util.Random#BadSize`

Good

> src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java line 149:
> 
>> 147:      */
>> 148:     public static void checkJumpDistance(double distance) {
>> 149:         if (!(distance > 0.0 && distance < Float.POSITIVE_INFINITY
> 
> I wounder if this usage of `Float.POSITIVE_INFINITY` intentional here? Looks a bit suspicious for comparison with `double` argument

Turns out the method is no longer used.

> src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java line 1548:
> 
>> 1546:          * @return a stream of (pseudo)randomly chosen {@code int} values
>> 1547:          */
>> 1548: 
> 
> Is `@Override` intentionally omitted?

The interface method is a default method, so not technically an override.

> src/java.base/share/classes/jdk/internal/util/random/RandomSupport.java line 1943:
> 
>> 1941: 
>> 1942:         // IllegalArgumentException messages
>> 1943:         static final String BadLogDistance  = "logDistance must be non-negative";
> 
> seems unused

Good.

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

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



More information about the security-dev mailing list