srand ( time (NULL) );
valueX = rand()%LIMIT+9; // Must start higher than 10
valueY = rand()%LIMIT+0;
valueZ = rand()%LIMIT+0;
LIMIT = 500
questi0n:
I'm trying to write a program that would randomly generate 3-digit numbers (000) and display the result. Also, the 3-digit numbers is the time elapsed in milliseconds on the user's computer. This program is running fine, however, the randomly generated numbers only changes every second, would it be possible to use srand ( time (NULL) );
generate a different random number every milliseconds instead?
Yes, as long as you only call srand ONCE, EVER, in your program. firedraco's code will easily generate a thousand random numbers in a second. Give it a try!