Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <4fd3c8bf-e45b-4359-ac50-f54298b14770
@d21g2000yqn.googlegroups.com>, tom@iahu.ca says...
>
> On Nov 3, 10:46 am, geo <gmarsag...@gmail.com> wrote:

> >   int refill( )
> >   { int i; unsigned long long t;
> >   for(i=0;i<41790;i++) { t=7010176LL*Q[i]+carry; carry=(t>>32); Q[i]=~
> > (t);}
> >   indx=1; return (Q[0]);
> >   }

>
> Not to nitpick but your C code could use some work. First off, some
> indentation please? Second, returning a unsigned long long as "int"
> is not very portable.


The O.P. is George Marsaglia. If there were a Mt. Rushmore for computer
science, Donald Knuth would be George Washington's bust, but Marsaglia
would be up there somewhere too. If it were random numbers, then Mr.
Marsaglia is front and center.

IMO-YMMV

> Part of the good thing of PRNGs is that they're reproduceable.
> Ideally over different platforms. You should truncate the return
> value if you want it as "int" or change the return type. As it stands
> now this will produce different results on my x86-32 and 64 boxes for
> the same seed, which is a bad thing.


Did you actually try it?
What compilers were you using?
I get the same result regardless of compiler, hardware and OS.



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.