[jdk11u-dev] RFR: 8280550: SplittableRandom#nextDouble(double,double) can return result >= bound [v3]

Paul Hohensee phh at openjdk.org
Tue Nov 1 20:07:34 UTC 2022


On Mon, 31 Oct 2022 17:26:47 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:

>> The original fix patches jdk/internal/util/random/RandomSupport.java.
>> This class is not in 11.
>> 
>> The Random code was completely reworked by
>> "8248862: Implement Enhanced Pseudo-Random Number Generators"
>> In the old 11 code there are several methods 'nextDouble' or
>> 'internalNextDouble' all using the same pattern.  They were
>> replaced by the implementation in the new class
>> RandomSupport in 17.
>> 
>> I adapted the following methods:
>> in java/util/Random.java:
>>   final double internalNextDouble(double origin, double bound)
>> 
>> in java/util/SplittableRandom.java
>>   final double internalNextDouble(double origin, double bound)
>>   public double nextDouble(double bound)
>> 
>> in java/util/concurrent/ThreadLocalRandom.java
>>   final double internalNextDouble(double origin, double bound)
>>   public double nextDouble(double bound)
>> 
>> I think this are all affected methods, but please double-check.
>> 
>> The change requires follow-up 8280950 which needs to be
>> adapted to touch the three internalNextDouble()
>> methods.
>
> Goetz Lindenmaier has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove stray comments

There's similar code in java.desktop/share/classes/sun/awt/geom/Curve.java, but it hasn't been updated in tip, so lgtm.

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

Marked as reviewed by phh (Reviewer).

PR: https://git.openjdk.org/jdk11u-dev/pull/1478


More information about the jdk-updates-dev mailing list