RAND(3C) SysV RAND(3C)
NAME
rand, srand - simple random-number generator
SYNOPSIS
#include <stdlib.h>
int rand()
void srand(seed)
unsigned int seed;
DESCRIPTION
The rand function computes a sequence of pseudo-random integers in the
range 0 to RAND_MAX, using a multiplicative congruential random-number
generator with period 2^32. Successive calls to rand return successive
numbers in the sequence.
The srand function uses its argument as a seed for a new sequence of
psuedo-random numbers to be generated by subsequent calls to rand. A
given value for seed will always cause rand to generate the same sequence
of numbers.
If rand is called before srand is called, rand behaves as if seeded with
a value of 1.
NOTES
The spectral properties of rand are limited. drand48 (see drand48(3C))
provides a much better, though more elaborate, random-number generator.
SEE ALSO
drand48(3C).