Files
oldlinux-files/Minix/1.7.5/MANUALS/CAT3/LRAND.3
2024-02-19 00:21:39 -05:00

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)