The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: RNGs: A Super KISS
Replies: 14   Last Post: Feb 26, 2013 10:53 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 554
Registered: 12/11/04
Re: RNGs: A Super KISS
Posted: Nov 3, 2009 3:39 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Tue, 03 Nov 2009 07:46:27 -0800, George Marsaglia wrote: ...
> For those mesmerized (or Mersenne-ized?) by a RNG with period 2^19937-1,
> I offer one here with period 54767*2^1337279---over 10^396564 times as
> long. It is one of my CMWC (Complimentary-Multiply-With-Carry) RNGs, and
> is suggested here as one of the components of a super-long-period KISS
> (Keep-It-Simple-Stupid) RNG.

> static unsigned long Q[41790],indx=41790,carry=362436,xcng=1236789,xs=521288629;
> {unsigned long i,x;
> printf(" x=%d.\nDoes x=-872412446?\n",x);
> Running this program should produce 10^9 KISSes in some 7-15 seconds.
> So I again invite you to cut, paste, compile and run the above C
> program.
> 1000 million KISSes should be generated, and the specified result
> appear [...]

I've snipped the program except for three lines that apparently must
differ depending upon cpu word length. On my 64-bit Athlon X2 5200+
(1GHz) with gcc 4.1.2, and %d changed to %ld, the output (after 7.5
seconds) contains "x=2904265093743181565."; or, with instead long
changed to int in two places, "x=-872412446." (after 7.3 seconds).


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.