Article View: att.lang.c++
Article #14Re: random number generator
From: Shane Beasley
Date: Sun, 01 Jun 2003 19:35
Date: Sun, 01 Jun 2003 19:35
19 lines
1702 bytes
1702 bytes
sbeasley@cs.uic.edu (Shane Beasley) wrote in message news:<2f2d78e1.0306010613.71adae94@posting.google.com>... > > // wait 1 millisecond > > > > VectCurrPtr[0] = (a * time() + c) % m; > > > > for (i = 1; i < NumElem; i++) > > VectCurrPtr[i] = (a * VectCurrPtr[i - 1] + c) % m; > > This is the lagged Fibonacci algorithm, Er, it's a linear congruential algorithm, though the two are related, apparently. http://www.wikipedia.org/wiki/Linear_congruential_generator http://www.wikipedia.org/wiki/Lagged_Fibonacci_Generators Anyway, they're both drop-in replacements for rand(), which you don't need. - Shane
Technical Details
Message-ID:
<2f2d78e1.0306011135.52c8c606@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailReferences:
<SikCa.1506$Z83.788@wagner.videotron.net> <2f2d78e1.0306010613.71adae94@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4ba,da54b5a763359bc3 X-Google-Attributes: gid10d4ba,public X-Google-Thread: 1014db,da54b5a763359bc3 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,da54b5a763359bc3 X-Google-Attributes: gid109fba,public X-Google-ArrivalTime: 2003-06-01 12:35:22 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: sbeasley@cs.uic.edu (Shane Beasley) Newsgroups: att.lang.c++,comp.lang.c,comp.lang.c++ Subject: Re: random number generator Date: 1 Jun 2003 12:35:22 -0700 Organization: http://groups.google.com/ Lines: 19 Message-ID: <2f2d78e1.0306011135.52c8c606@posting.google.com> References: <SikCa.1506$Z83.788@wagner.videotron.net> <2f2d78e1.0306010613.71adae94@posting.google.com> NNTP-Posting-Host: 12.249.234.146 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1054496122 25142 127.0.0.1 (1 Jun 2003 19:35:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 Jun 2003 19:35:22 GMT