> 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.
Raffaello Giulietti has updated the pull request incrementally with two additional commits since the last revision: - Added tests. - Align code comment with @implSpec. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/12719/files - new: https://git.openjdk.org/jdk/pull/12719/files/bc0021cd..b867d275 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=12719&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12719&range=06-07 Stats: 356 lines in 2 files changed: 354 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/12719.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/12719/head:pull/12719 PR: https://git.openjdk.org/jdk/pull/12719