Hi there.
The problem: I have a random generator function which every time its called generates the identical number. When I used this same function in a prior program the rand worked fine. But in the new code it now seems to generate same value.
The random generator function is...
1 2 3 4 5 6 7
int diceroll ()
{
srand (time (NULL));
int onetosix = (rand()%6+1);
return onetosix;
}
Even when I dispense with the 'diceroll function' and have the random generator inline the same thing occurs. I have previously had this problem but after reading other peoples woes in this regard, on other threads, I did in fact solve this when it was suggested they insert the...
srand (time (NULL));
...srand line and that indeed worked fine. But it now seems otherwise in the new project.
Note; The headers in the new project are the same as in the other program.
I believe...
#include <ctime>
...was important and thats included in the headers.