+ 4
What is srand command ?
explain in brief..
2 Respostas
+ 3
bro run a program using rand.
now look at output u will get random output.
now run again the output would be exactly same as before.
what does srand() do?? it takes in seed (any value)
which alters the randomness.
but if u seed any constant/variable inside srand then also output would be same.
to deal with that we seed current time in srand
which changes continuosly and hence we get truly random outputs
+ 2
it is to tell compiler that rand ()is coming