What is the srand() function from the standard library used for?
Explanation
The rand function will constantly return the same sequence of random numbers. This is convenient only at the debugging stage. In order for the sequence to be different all the time, when starting the application, you need to specify seed - this is achieved by calling srand. See srand().

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes