commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (RNG-37) Ziggurat algorithm
Date Sat, 09 Dec 2017 11:13:00 GMT


Gilles commented on RNG-37:

bq. keeps only 7 bits out of the 32

Sorry, this is incorrect: the value returned by {{nextInt()}} serves as a multiplier, so all
32 are used.
So, for a source that generate 64-bits at a time, "only" 32-bits are wasted; the question
is then whether the additional (branching) logic for reusing those bits would not completely
offset the gain of generating one value in place of two.
I did some trial, and it seems that the gain is indeed insignificant.

A different issue is that the code seems to copy statements that generate {{float}} values
in the [reference implementation|].
In the Java port, the hard-coded values that seems to have less precision than they should
(since {{double}} values are generated here). E.g. is a statement such as
uni = 0.5 + nextInt() * 0.2328306e-9;
not going to miss {{double}} values close to 1?

> Ziggurat algorithm
> ------------------
>                 Key: RNG-37
>                 URL:
>             Project: Commons RNG
>          Issue Type: Wish
>            Reporter: Gilles
>            Priority: Minor
> Fast algorithm for sampling a Gaussian distribution:

This message was sent by Atlassian JIRA

View raw message