void rand ( unsigned int seed );
Initialize random number generator.
Uses seed parameter to set a new starting point for generating random numbers with rand.
If seed is set to 1 the generator is reinitialized to its initial value as before any call to rand or srand.
In order to generate true random numbers it is suggested to use as seed a value that changes often, like the one returned by time function included in <time.h> (the number of seconds elapsed since newyear 1970).
Defined in ANSI-C.
/* rand/srand example */
/* initialize random generator */
srand ( time(NULL) );
/* generate some random numbers */
printf ("A number between 0 and 100: %d\n", rand()%100);
printf ("A number between 20 and 30: %d\n", rand()%10+20);
A number between 0 and 100: 93
A number between 20 and 30: 21