Export (0) Print
Expand All
div
eof
Expand Minimize

srand 

Sets a random starting point.


void srand(
   unsigned int seed 
);

Parameters

seed

Seed for random-number generation

The srand function sets the starting point for generating a series of pseudorandom integers. 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 Compatibility

srand

<stdlib.h>

ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For additional compatibility information, see Compatibility in the Introduction.

See the example for rand.

Community Additions

ADD
Show:
© 2015 Microsoft