I use the code as follow to generate a random number between 10000 and 60000.
(int)round(1.0 * rand() / RAND_MAX * 50000 + 10000)
My Question is why 1.0 * rand()
, and what is the difference with only rand()
, not multiply 0.1?
Your answers are highly appreciated!