a (non-critical) flaw in taus RNG
Atakan Gurkan
ato@northwestern.edu
Tue Apr 23 02:00:00 GMT 2002
Hi,
In his paper "Tables of Maximally-Equidistributed Combined LFSR Generators",
Mathematics of Computation, 68, 225 (1999), 261--269:
http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps
Pierre L'Ecuyer says:
In other words, the k_j most significant bits of z_j must be non-
zero, for each j. (Note: this restriction also applies to the
computer code given in [4], but was mistakenly not mentioned in
that paper.)
[4] is the source of the algorithm used in taus.c in GSL, for certain initial
seeds the quoted condition will not be satisfied, due to the method of choosing
s_n from s_{n+1} in taus.c, eg:
69069*2783094533-44756*2^32 = 1
69069*2542443540-40886*2^32 = 4
it is not too hard to find other examples. This is of course not critical
but formally it might cause problems.
Solutions that come to my mind are:
-- checking if s1, s2, s3 are below 2, 8, 16 respectively and add a fixed
number, this will probably have a speed impact.
-- using something like "s_n = (69069 * s_{n-1}) mod 2^31 + 20" instead of
the original "s_n = (69069 * s_{n-1}) mod 2^32"
-- leaving it as it is :-)
On another note, this second paper includes tables for RNG with longer
periods and RNGs for 64bit architecture. I would be writing routines
implementing them and wouldn't mind making them a part of GSL. However, I
would need someone to take a look at the code to make sure it complies with
GSL coding style etc. How does this work? Do I write them and make them
available under GPL and somebody else integrates them to GSL or can I make
this integration myself?
Atakan Gurkan
More information about the Gsl-discuss
mailing list