Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-171
srand
srand
The srand function resets the pseudo-random sequence generator to a new starting point.
seed
specifies the new starting point, or seed, for the pseudo-random sequence generator.
Return Value
none.
Usage Guidelines
•
At program startup, the generator’s seed is set to one.
•
Calling srand with a given value of seed always produces the same sequence of
pseudo-random numbers.
Example
This example resets the pseudo-random sequence generator to a new starting point:
#include <stdlibh>
/* ... */
int x;
unsigned seed;
seed = 15;
srand(seed);
/* ... */
x = rand();
#include <stdlibh>
void srand(unsigned int seed);