View Single Post
Re: Portable, self-contained replacements for RANDOM_STUFF()
Old
  (#8)
botmeister
Ex-Council Member
 
botmeister's Avatar
 
Status: Offline
Posts: 1,090
Join Date: Nov 2003
Location: Canada
Default Re: Portable, self-contained replacements for RANDOM_STUFF() - 07-01-2004

Quote:
Originally Posted by Pierre-Marie Baty
yes... more than 32767 waypoints/nodes/walkfaces/navlinks/whatever.

One reason among others

Also, I assure you that the random results are very convincing : the algorithm is based on an infinite math suite, whose start point is determined by the initial seed - and this implementation is VERY fast, much faster than calling rand() twice. I believe the guy who wrote this did a math paper somewhere, it must be lying around on the net
Yes, it is supposed to be a good random generator algo, look for references
S.K. Park and K.W. Miller, Communications of the ACM 31:10 (Oct 1988, and "Two Fast Implementations of the 'Minimal Standard' Random Number Generator", David G. Carta, Comm. ACM 33, 1 (Jan 1990), p. 87-88 linear congruential generator f(z) = 16807 z mod (2 ** 31 - 1) uses L. Schrage's method to avoid overflow roblems


I found this on-line postscript book http://www.ma.utexas.edu/documentation/nr/bookc/

Look at c7-1.ps it discusses a lot of things, and it says this is probably the simplest and fastest random number generator of all

Code:
unsigned long idnum;
 
unsigned long lrand( )
{
idnum = 1664525L * idnum + 1013904223L;
return idnum;
}


Maker of the (mEAn) Bot.Admin Manager

"In theory, there is no difference between theory and practice. But, in practice, there is." - Jan L.A. van de Snepscheut

Last edited by botmeister; 08-01-2004 at 00:05.. Reason: Forgot to explicitly define the constants as long
  
Reply With Quote