MSfUnifRand
Routine

double MSfUnifRand (void)

void MSrandSeed (int seed)
Purpose

Generate a uniformly distributed pseudorandom value

Reseed the uniform pseudorandom value
Description
This routine generates uniformly distributed pseudorandom numbers. The
multiplicative congruential method is used to generate integer pseudorandom
numbers, is = (a*is) % m. The values a=16807 and m=2147483647 are used.
These values have been shown to give good results. Further, the values
generated are shuffled to give better serial correlation properties. The
pseudorandom number generation routine is self initializing, but if a
different sequence of pseudorandom values is desired, the routine MSrandSeed
can be used to supply a starting (seed) value.

Reference:

W. H. Press, S. A. Teukolsky, W. T. Vetterling, B. P. Flannery,
"Numerical Recipes in C" (2nd ed.) (p. 280), Cambridge University Press,
1992.
Parameters

MSfUnifRand:

< double MSfUnifRand

Uniform deviate with values between 0 and 1, exclusive of the end points.

MSrandSeed:

> int seed

Seed value. A positive seed value sets the pseudorandom generation to a
new sequence. A zero value sets the actual seed to a value based on the
current time. The default sequence can be restarted by setting the seed
value to 12345.
Author / revision
P. Kabal
/ Revision 1.18 2003/05/09
See Also
MSfGaussRand
Main Index libtsp