Integer type (typically 4 bytes, 0 to 4,294,967,295)
1st Parameter
The seed value to initialize the pseudo-random number generator. Providing the same seed produces the same sequence of random numbers.
Read more about parameters of srand in parameters section
The srandfunction in C language Seeds the pseudo-random number generator used by rand().
The srand function sets the starting point for producing a series of pseudo-random integers. If srand is not called, the rand() function behaves as if srand(1) has been called at program start. Any other value for seed sets the generator to a different starting point.
The srandfunction takes 1
parameter:
•
unsigned int `seed`: The seed value to initialize the pseudo-random number generator. Providing the same seed produces the same sequence of random numbers.
Initializes the pseudo-random number generator used by `rand` with the specified seed value `seed`. This function ensures reproducibility of the random sequence if the same seed is used. It does not return a value.
The srand function return value :
This function does not return a value
Output
This example seeds the random number generator with the current time and generates 5 random numbers between 0 and 99.