Hello,
I noticed the following behaviour when initialising the random number generator on a 64bit machine. Basically, on a 64 bit machine, the unsigned long int probably provokes an overflow in the gsl_rng_set() function, so that the initialisation of the seed in some way fails, and I got always identical numbers despite different seeds. Here is part of the code that made the overflow:

unsigned long int un_seed = GetSomeSeed(); // this function returns a random number in [0,ULONG_MAX]

gsl_rng_env_setup();
T = gsl_rng_default;
gsl_rng* r = gsl_rng_alloc ( T );
gsl_rng_set ( r, un_seed );    // here probably the overflow

int value = gsl_rng_uniform_int(r, 1000); // retruns always the same number, despite different seeds


For the time being, I bypassed the problem by limiting the seed to UINT_MAX, which does not produces overflows on the 64bit machines.
I hope this report is useful....


regards,
Vito



--
==========================================================================
Vito Trianni, Ph.D.                  vito.trianni@(no_spam)istc.cnr.it
CNR-ISTC                             http://iridia.ulb.ac.be/~vtrianni
via San Martino della Battaglia, 44     
00185 Roma                           Tel: +39 06 44595 215
Italy                                Fax: +39 06 44595 243
==========================================================================





_______________________________________________
Bug-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gsl

Reply via email to