I made a simple program that allows the user to pick a number of dice then guess the outcome... I posted this code before but with the wrong question so it was deleted... no
That's because on your system, time_t
is a larger integer type than unsigned int
.
time()
returns a time_t
which is probably a 64-bit integer.srand()
wants an unsigned int
which is probably a 32-bit integer.Hence you get the warning. You can silence it with a cast:
srand ( (unsigned int)time(NULL) );
In this case, the downcast (and potential data loss) doesn't matter since you're only using it to seed the RNG.