Programming/C++

Random 숫자 얻기

파란크리스마스 2007. 12. 18. 00:51
728x90

 FILETIME ft;
 GetSystemTimeAsFileTime(&ft);
 static DWORD dwVal = 0x21;
 DWORD dwSeed = (dwVal++ << 0x18) | (ft.dwLowDateTime & 0x00ffff00) | dwVal++ & 0x000000ff;
 srand(dwSeed);

 int iRandom = rand()%10+1;

728x90