Yet another pseudo-random number generator

Moshe Braner braner at batcomputer.tn.cornell.edu
Wed Feb 22 08:05:58 AEST 1989


[David Goodenough pointed out some supposed problems with my PRNG]

My method (posted here recently) is NOT parallel LCGs, it is 16 or 32
parallel occurences of the (in)famous "shift register" algorithm.
While it is true that each bit position, taken alone, is not a very
good basis for PRNs, tests show that the 32 independent "registers"
provide pretty good 32-bit random long ints.  With my method there is
no actual shifting of the bits in each register, instead I just bump
a pointer to a position on a ring.  MUCH faster.  (To make merrier, I also
roll one column in the matrix of bits (around the OTHER axis than the
rows used for the "shift" of the registers) one bit per call.  But that
is not essential.)

For seeding, I take ONE seed int and generate 31 "random" seeds out of it
using a LCG (for the seeding only).  It is true that, with VERY small
probability, one bit position may be stuck at all 0's, but the extra rolling
mentioned above will destroy that state.

I still claim that this is a very fast generator with no deficiencies known
to me.  Anybody got their favorite killer PRNG tests ready to shoot?  :-)

- Moshe Braner

Cornell Theory Center, 265 Olin Hall,
Cornell University, Ithaca, NY 14853
(607) 255-9401	(Work)
<braner at tcgould.tn.cornell.edu>		(INTERNET)
<braner at crnlthry> or <braner at crnlcam>	(BITNET)



More information about the Comp.lang.c mailing list