0

difference between rand() and srand()...????

8th Jul 2017, 3:59 PM
Hassam Usmani
Hassam Usmani - avatar
2 Answers
+ 9
rand() returns a 'random' number. srand() is used to seed the RNG algorithm. Check out how seeding works: https://code.sololearn.com/cMUCJqFL1X65/?ref=app
8th Jul 2017, 4:01 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
rand() returns a random number srand() sets the seed to get the random numbers See ‎https://en.m.wikipedia.org/wiki/Linear_congruential_generator
8th Jul 2017, 4:12 PM
Andrés04_ve
Andrés04_ve - avatar