23 lines
660 B
Groff
23 lines
660 B
Groff
|
|
SUBROUTINES
|
|
lrand - lehmer random number generator
|
|
INVOCATION
|
|
long seed( lseed )
|
|
long lseed;
|
|
long lrand()
|
|
EXPLANATION
|
|
Lrand(3) uses a prime modulus multiplicative linear
|
|
congruential generator (PMMLCG) to generate a pseudo-
|
|
random number in the range 1 to 2147483646 {LONG_MAX}-1.
|
|
The generator is much more random than rand(3), especially
|
|
in the low order bits. The formula used is:
|
|
seed = (16807 * seed) % 2147483647
|
|
Seed(3) sets the seed to an initial value, the default
|
|
is 1.
|
|
RESULTS
|
|
Lrand(3) returns the next value of seed.
|
|
Seed(3) returns the previous value of seed.
|
|
REFERENCES
|
|
rand(3)
|
|
|