
srand() or rand()???
hi there,
I am writing a game that is suppose to have a dice in it. In this program there are 2 players and i want each of them to spin the dice and get different numbers.
My question is, do you u think that it is better to use rand() or srand() to represent the dice. I was thinking that if you use the rand() function that both players would get the same numbers all the time. What do you think.
Thanks in advance

Well, you should use both. Read about random number generation here.

srand() is used to ensure that everytime you run the program that the numbers generated will be unique each run (in theory). rand() is used to generate the random number.
Have a look at the functions from here...
http://www.cprogramming.com/function.html


Thanks alot for both your help :)