PreviousIndexLast

[bug-gsl] Re: initialisation of random number generator on 64bit machine (2008-09-15)

From: Brian Gough <bjg@gnu.org>
Subject: Re: initialisation of random number generator on 64bit machine
Date: Mon, 15 Sep 2008 15:57:30 +0100
To: Vito Trianni <vtrianni@.........>
Cc: bug-gsl@gnu.org

At Fri, 12 Sep 2008 16:52:48 +0200,
Vito Trianni wrote:
> Please find attached an example program that reproduces the error I
> was experiencing. I tested it on both 32- and 64-bit architectures,
> and it actually does not produce random values on the latter (see the
> "local" values in the last line of output: it varies across different
> runs on 32-bit architectures, but it does not on 64-bit ones).

Thanks for the example program.

What is happening here is that your seeding expression
floor(value*((1.0 + max - min)+min)) always returns values which are
multiples of 2^32, due to the limited range of double values being
returned. These are mapped to the same seed (zero) modulo 2^32.

I have added a note to the manual that the generators only accept
32-bit seeds.

--
Brian Gough

GNU Scientific Library -
http://www.gnu.org/software/gsl/