RFR: 8302987: Add uniform and spatially equidistributed bounded float/double streams to RandomGenerator
Raffaello Giulietti
rgiulietti at openjdk.org
Wed Feb 22 15:32:34 UTC 2023
The `default` method `nextDouble(double origin, double bound)` in `java.util.random.RandomGenerator` aims at generating a uniformly and spatially equidistributed random `double` in the left-closed and right-open range [`origin`, `bound`). It does so by applying the affine transform `origin + (bound - origin) * r` to a uniformly and spatially equidistributed random `double` `r` in the range [0, 1).
Since floating-point arithmetic suffers from small but noticeable rounding errors, this ends up slightly deforming the distribution of `r` when applying the affine transform.
-------------
Commit messages:
- 8302987: Add uniform and spatially equidistributed bounded float/double streams to RandomGenerator
Changes: https://git.openjdk.org/jdk/pull/12719/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12719&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8302987
Stats: 253 lines in 1 file changed: 251 ins; 1 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/12719.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12719/head:pull/12719
PR: https://git.openjdk.org/jdk/pull/12719
More information about the core-libs-dev
mailing list