Aug 6, 2013

[C/C++] how to change the random number seed every milisecond

(1) This changes the random number seed every second.
#include <time.h>
srand(time(NULL));

(2) This changes the random number seed every milisecond.
#include <Windows.h>
srand(GetTickCount());   // This uses CPU clock instead.

No comments:

Post a Comment