Heya,

On Mon 26 Jul 2010 23:01, Andreas Rottmann <a.rottm...@gmx.at> writes:

> scheme@(guile-user)> (random (ash 1 32))
> ERROR: In procedure random:
> ERROR: Argument 1 out of range: 4294967296

Well, it's not a segfault at least :)

The point of that change was to indicate that the RNG did not return
sizeof(unsigned long) bits of randomness; it always returned 32
bits. See the note in "BSD Random Number Functions" in libc's manual:

     *NB:* Temporarily this function was defined to return a `int32_t'
     value to indicate that the return value always contains 32 bits
     even if `long int' is wider.  The standard demands it differently.
     Users must always be aware of the 32-bit limitation, though.

I'll fix this now to avoid the error, but there is still work to do on
the RNG -- we really need to update the RNG, I think. Brian Gough, the
GSL maintainer, says MT19937 is the one to use, and specifically the new
SIMD version at
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html. We
should replace our MWC RNG with that one.

Would you be interested in doing this? We would need some test
suites too, I think, and possibly changes to the scm_t_rng structure.

Cheers,

Andy
-- 
http://wingolog.org/

Reply via email to