On 07/09/2012 05:24 AM, Mario S. Mommer
That is very flawed behavior in a random number generator you are
describing. What is the status of your patch?
Jeffrey Cunningham <firstname.lastname@example.org> writes:
Have you looked at a distribution of the outputs? I'm wondering if there's
something else wrong. You really shouldn't see zero show up as an argument to
log except once in a blue moon.
When using single floats, the probability of obtaining a zero is not so
low, at least with the usual way of generating random floats.
The following code usually returns in less than a second on my home
(let ((i 0)) (loop while (> (random 1.0s0) 0) do (incf i)) i)
This one takes a lot longer:
(let ((i 0)) (loop while (> (random 1.0d0) 0) do (incf i)) i)
There are other, arguably better, ways to generate random floats, and
then zeros are really unlikely to happen. With this patch,
a single-float zero appears on average every (expt 2 150) calls to
(random 1.0s0), which for practical purposes means never.