Whole New World
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment