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

Goetz Lindenmaier goetz at openjdk.org
Thu Nov 3 14:15:23 UTC 2022


On Wed, 26 Oct 2022 13:48:17 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.

This pull request has now been integrated.

Changeset: 91f15382
Author:    Goetz Lindenmaier <goetz at openjdk.org>
URL:       https://git.openjdk.org/jdk11u-dev/commit/91f1538246309143557f481c4a4964279f235932
Stats:     57 lines in 4 files changed: 52 ins; 0 del; 5 mod

8280550: SplittableRandom#nextDouble(double,double) can return result >= bound

Reviewed-by: phh
Backport-of: 0c42e43f77b91a50fedc3fddb74e17f910d8df2a

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

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


More information about the jdk-updates-dev mailing list