bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl] show-stopping gsl_rng_set bug (with workaround)


From: Frank Reininghaus
Subject: Re: [Bug-gsl] show-stopping gsl_rng_set bug (with workaround)
Date: Sun, 18 Mar 2012 23:20:37 +0100

Hi,

Am 15. März 2012 13:54 schrieb Havona Studios:
> The minstd, ran0, ran1, ran2 algorithms are show-stoppingly buggy when
> unsigned long is used to seed.  Workaround is to use unsigned int.
>
> minstd and ran0 are not producing uniform floats/doubles (compare
> result with default) and go into 100% CPU loop on uniform_int, while
> ran1 and ran2 will simply segfault on either function call.
>
> default and all others work as expected/documented.

I can confirm the problem, but only on a 64 bit system.

Looking at the code where ran1 and ran2 crash seems to indicate that
the functions assume implicitly that the "state" variable is a 32 bit
number. Therefore, the fix would be to ensure that this is really the
case in the *_set functions for these generators.

The documentation [1] already says that some generators will reduce
the seed to 32 bits. It seems that this was accidentally not done for
the buggy generators.

Best regards,
Frank

[1] 
http://www.gnu.org/software/gsl/manual/html_node/Random-number-generator-initialization.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]