rng question

Jari Häkkinen jari@chiralcomp.com
Fri Dec 9 13:49:00 GMT 2005


No, the attached program does not return from the call to 
gsl_rng_uniform_int.

The problem shows up on my powermac running MacOSX 10.4.3 with gcc 
version powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple 
Computer, Inc. build 4061).
I compile GSL from CVS (20051208 = today) with with flags -NDEBUG -O2. 
The test program is compiled with a plain 'gcc -o rnd_test rnd_test.c 
-lgsl'.

Now, I also run the test program on a SuSE based machine, and the call 
fails with an floating point exception as expected.


Jari


Brian Gough wrote:
> Jari Häkkinen writes:
>  > According to the documentation gsl_rng_max(rng_ returns the maximum 
>  > random number the underlying rng can give, and 
>  > gsl_rng_uniform_int(rng,gsl_rng_max(rng)) will return 
>  > [0,gsl_rng_max(rng)-1]. This will not give the maximum number from the 
>  > underlying generator, so I tried 
>  > gsl_rng_uniform_int(rng,gsl_rng_max(rng)+1) but this call does not 
>  > return (since the second argument becomes 0).
> 
> Doesn't it give an exception? (due to division by zero in the expression scale = range / n;)
> What platform are you using?
> 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rnd_test.c
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20051209/c1e91218/attachment.c>


More information about the Gsl-discuss mailing list