[jdk11u-dev] RFR: 8280550: SplittableRandom#nextDouble(double,double) can return result >= bound [v2]
Goetz Lindenmaier
goetz at openjdk.org
Sun Oct 30 18:54:05 UTC 2022
> 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:
Add Test forgotten in orig commit.
-------------
Changes:
- all: https://git.openjdk.org/jdk11u-dev/pull/1478/files
- new: https://git.openjdk.org/jdk11u-dev/pull/1478/files/d43bf1d1..e884b536
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk11u-dev&pr=1478&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk11u-dev&pr=1478&range=00-01
Stats: 52 lines in 1 file changed: 52 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk11u-dev/pull/1478.diff
Fetch: git fetch https://git.openjdk.org/jdk11u-dev pull/1478/head:pull/1478
PR: https://git.openjdk.org/jdk11u-dev/pull/1478
More information about the jdk-updates-dev
mailing list