Integrated: 8302987: Add uniform and spatially equidistributed bounded double streams to RandomGenerator

Raffaello Giulietti rgiulietti at openjdk.org
Wed Jul 19 16:52:03 UTC 2023


On Wed, 22 Feb 2023 15:23:13 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 14cf0356
Author:    Raffaello Giulietti <rgiulietti at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/14cf035681460e8c93d6afcaaf20aa61c8a6e3a8
Stats:     521 lines in 2 files changed: 519 ins; 1 del; 1 mod

8302987: Add uniform and spatially equidistributed bounded double streams to RandomGenerator

Reviewed-by: darcy

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

PR: https://git.openjdk.org/jdk/pull/12719


More information about the core-libs-dev mailing list