Re: BZDEV: RNGs

From: tveldhui (tveldhui@extreme.indiana.edu)
Date: Mon Jan 25 1999 - 14:17:06 EST


Uniform is adapted from DLARAN in LAPACK. It is finished and usable,
except that "randomize()" is not implemented. It has period 2^48-1.

TT800 is a "twisted generalized feedback shift register (TGFSR)"
RNG. It has period 2^800-1. However, it currently only generates
32 bits of precision. The changes required to up this to 53
bits (ieee double) are minor (basically, just generate 2 random
integers and use their bits to fill out to full precision).
The comment in the code said that there were only 15 bits of
precision, but this was wrong (I've changed it now).

TT800 is fine if you are working with floats (only 24 bits
of mantissa).

I've bumped up the precision of TT800 to 64 bits (this change
will appear in the next release).

Also, randomize() in TT800 is not implemented. Oops, it
is not implemented in Uniform either.

> The random generator used by my Monte Carlo generates uniformly two
> integers x and y and then builds a floating-point number z=(x+y/m1)/m0
> where m0 = 1664557 and m1 = 1048583. If z is a double and assuming that
> integers have 32 bits, does this algorithm gives 53 significant bits for
> the significand of z ? (Sorry to ask a question not directly related to
> Blitz++)

I notice that log2(m0 * m1) = 40.67. So if z is in the range [0,1)
then there is no way for it can only have 40 bits of precision,
not 53. I think.

Cheers,
Todd

--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo@oonumerics.org, with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:08 EST