This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: rng/ranlxd.c
- From: Brian Gough <brian dot gough at network-theory dot co dot uk>
- To: Carsten Urbach <Carsten dot Urbach at physik dot fu-berlin dot de>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Sun, 15 Dec 2002 12:40:12 +0000 (GMT)
- Subject: Re: rng/ranlxd.c
- References: <20021213174236.GC16463@physik.fu-berlin.de>
Carsten Urbach writes:
> Hi,
> I downloaded gsl version 1.2 because I was interested in the
> project and especially in the double precision version of the
> ranlux random number generator. I have one remark about your
> implementation, I do not know whether this is important:
> static inline unsigned long int ranlxd_get (void *vstate) {
> return ranlxd_get_double (vstate) * 4294967296.0; /* 2^32 */
> }
> With 2^32 you will not get the whole range of the double precision
> version. To get it you would have to multiply with 2^48. Of course
> this is in general to big for a unsigned long int ... (but unsigned
> long long int would do)
> This is not a serious bug, but the quality of the generator
> decreases.
The gsl_rng_uniform (ranlxd_get_double) method returns all 48 random
bits in the range [0,1). See the docs for that function in the manual.
Brian