Xinu7/man/man3/rand.doc




RAND(3)             Xinu Programmer's Manual              RAND(3)



NAME
     rand, srand - random number generator

SYNOPSIS
     srand(seed)
     int seed;

     rand()

DESCRIPTION
     _R_a_n_d uses a multiplicative congruential random number gen-
     erator with period 28329 to return successive pseudo-random
     numbers in the range from 0 to 28319-1.

     The generator is reinitialized by calling _s_r_a_n_d with 1 as
     argument.  It can be set to a random starting point by cal-
     ling _s_r_a_n_d with whatever you like as argument.

BUGS
     _R_a_n_d does not provide mutual exclusion among calling
     processes.  Thus, there is a small chance that two con-
     current processes will receive the same value.

































Version 6b               Printed 1/12/87                        1