What is srand function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
5th Sep 2020, 6:51 PM
Shahriar
Shahriar - avatar
3 Answers
+ 4
The srand() function sets the starting point for producing a series of pseudo-random integers. If srand() is not called, the rand() seed is set as if srand(1) were called at program start. Any other value for seed sets the generator to a different starting point. https://www.sololearn.com/learn/CPlusPlus/1638/?ref=app
5th Sep 2020, 7:07 PM
Dreamer
Dreamer - avatar
+ 3
pseudo-random number generator, it seeds the pseudo-random number generator used by the rand() function http://www.cplusplus.com/reference/cstdlib/srand/ https://www.tutorialspoint.com/cplusplus-program-to-use-rand-and-srand-functions
5th Sep 2020, 6:54 PM
Steven M
Steven M - avatar
+ 3
Srand() function is used for generat random numbers, these random number , choose by compiler, that is declared in <time.h> library file. Syntax: srand (time(NULL));
5th Sep 2020, 7:12 PM
Rupali Haldiya
Rupali Haldiya - avatar