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 ]
Dann Corbit

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

On Nov 3, 12:39 pm, James Waldby <> wrote:
> 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).

I get the same results on:
64 bit Windows using the 64 bit MS compiler
64 bit Windows using the 32 bit MS compiler
64 bit Windows using the 64 bit Mingw GCC compiler
64 bit OpenVMS (Itanium) using HP CXX
64 bit OpenVMS (Alpha) using HP CXX
32 bit OpenVMS (VAX) using HP CXX (Had to remove the std:: because of
old compiler, expect a very long wait)
Solaris 5.9 is interesting because it is big-endian, in contrast with
those previously mentioned:
/export/home/dcorbit> uname -a
SunOS solaris9 5.9 Generic_118558-11 sun4u sparc SUNW,Sun-Fire-V210
/export/home/dcorbit> gcc --version
gcc (GCC) 4.0.2
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
/export/home/dcorbit> ./a.out
x = -872412446
Does x=-872412446?

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.