SRAND - set seed for random number generation.

(ANSI Standard)

Usage:

#include <stdlib.h>
srand( seed );

Where:

unsigned seed;
is a starting value for a progression of random numbers.

Description:

"srand" sets the "seed" for a pseudo-random number generator. Once the seed has been set, you may call "rand" to obtain pseudo-random numbers.

If you always use the same seed, you will always obtain the same sequence of pseudo-random numbers from "rand". This helps you to duplicate results for debugging purposes. A useful random sort of seed might be based on the time of day.

See Also:

expl c lib rand

Copyright © 1996, Thinkage Ltd.