New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8280550: SplittableRandom#nextDouble(double,double) can return result >= bound #1478
Conversation
|
This backport pull request has now been updated with issue from the original commit. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's similar code in java.desktop/share/classes/sun/awt/geom/Curve.java, but it hasn't been updated in tip, so lgtm.
@GoeLin This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 11 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
Good catch of this further appearance. I agree the fix is not needed there. But the methods there might not always deliver the previous double either. |
Perhaps file a bug against tip, fix it, and backport. |
/integrate |
Going to push as commit 91f1538.
Your commit was automatically rebased without conflicts. |
I opened JDK-8296402 for the pattern in Curve.java. |
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.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev pull/1478/head:pull/1478
$ git checkout pull/1478
Update a local copy of the PR:
$ git checkout pull/1478
$ git pull https://git.openjdk.org/jdk11u-dev pull/1478/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1478
View PR using the GUI difftool:
$ git pr show -t 1478
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/1478.diff