+ 1

What's the difference between srand and rand function?

and if we can generate random numbers with the help of rand () function only then why we use srand () function?

16th Feb 2018, 6:54 PM
Shridhar Rai
Shridhar Rai - avatar
1 Resposta
0
Run this multiple times with srand decommented and then a few times commented: https://code.sololearn.com/c5A5D3DcA3s6/?ref=app rand() is just a list of numbers. with srand seeds rand. This means you get another entry point to the numbers rand produces. Without srand the numbers would be the same, because it always starts at the beginning
16th Feb 2018, 7:05 PM
Alex
Alex - avatar