srand
Sets a random starting point.
void srand(
unsigned int seed
);
Параметры
- seed
Seed for random-number generation
Заметки
The srand function sets the starting point for generating a series of pseudorandom integers in the current thread. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. rand retrieves the pseudorandom numbers that are generated. Calling rand before any call to srand generates the same sequence as calling srand with seed passed as 1.
Требования
Routine |
Required header |
---|---|
srand |
<stdlib.h> |
For additional compatibility information, see Compatibility in the Introduction.
Пример
See the example for rand.