For x86, direct call to the CPU time stamp counter rdtsc
, instead of a library function TIME(NULL), could be used. Below 1) reads timestamp 2) seed RAND in assembly:
rdtsc
mov edi, eax
call srand
For C++, the following would do the job with g++ compiler.
asm("rdtsc\n"
"mov edi, eax\n"
"call srand");
NOTE: But may not be recommended if code is running in virtual machine.