[
https://issues.apache.org/jira/browse/RNG-37?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16290342#comment-16290342
]
OlgaK commented on RNG-37:
--------------------------
{quote}Then it looks like the whole procedure needs to be adapted, not only the
tail.
Indeed generating a single 32-bits value (nextInt(), at line 98) won't return
any of the double values (64-bits) that would require a different setting of
any one of the missing 32-bits.{quote}
I think missing 32-bits contribute to the precision (having 7 decimal digits vs
having 16). For Gaussian in high density area having 8th and after digits
doesn't make a notable effect, while in the low density are it does indeed.
I'm fairly sure it's just the tail. Besides when one tries to increase
precision switching from float to double but still keeps the same number of
fitting blocks...
Overall the fit is so to say good enough to pass the test. But it's not a big
deal to switch to Long. Moreover, it has been my original thought to make the
calcs in long and I've even added the missing long random in the main codebase
but then I switched to int.
Actually as you may notice in the paper there is another application of the
algorithm - to fit exponential distribution. I've tried to add this one as well
but there was severe test failure and since it has not been requested, I
decided to skip it. But there indeed all numbers need to be recalculated.
{quote}Then, I wonder how to make sure that no holes remain. Is it possible to
set up a unit test? If not, a last resort idea might be to make a plot of many
generated values, superimposed with a plot of a uniform sampling, and look for
anomalies (empty regions). {quote} The rng has a very well done testing module.
It allows people, coming from street or bb, to test their code adding just a
single line in the test suite. I was really impressed. I didn't get into
details by what criteria it assesses the quality of generated distribution but
it definitely more than just a single number pick (based on what I recall how
the 2d distribution test failed). If you think it doesn't make a check for the
wholes, it definitely would be a great idea to add it (not just for Ziggurat
test but for all distributions). The person who had written the testing module,
definitely could do it better and faster. For a "side person" imho it'd require
substantial time and efforts. One can make it as a task for "Help wanted" bb
but don't have over expectations :).
I'll do switch int -> long. Try to do it to the nearest weekend.
I didn't get your last message "Fix Version/s" ??
> Ziggurat algorithm
> ------------------
>
> Key: RNG-37
> URL: https://issues.apache.org/jira/browse/RNG-37
> Project: Commons RNG
> Issue Type: Wish
> Reporter: Gilles
> Priority: Minor
> Fix For: 1.1
>
>
> Fast algorithm for sampling a Gaussian distribution:
> https://en.wikipedia.org/wiki/Ziggurat_algorithm
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)