Go to the first, previous, next, last section, table of contents.


srand

Syntax

#include <stdlib.h>

int srand(unsigned seed);

Description

Initializes the random number generator for rand(). If you pass the same seed, rand() will return the same sequence of numbers. You can seed from section time or section rawclock.

Portability

ANSI, POSIX

Example

/* random pause */
srand(time(0));
for (i=rand(); i; i--);


Go to the first, previous, next, last section, table of contents.