+ 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?
1 Answer
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