1 // Common/Random.cpp 2 3 #include "StdAfx.h" 4 5 #include <stdlib.h> 6 7 #ifndef _WIN32 8 #include <time.h> 9 #else 10 #include "MyWindows.h" 11 #endif 12 13 #include "Random.h" 14 Init(unsigned seed)15void CRandom::Init(unsigned seed) { srand(seed); } 16 Init()17void CRandom::Init() 18 { 19 Init((unsigned) 20 #ifdef _WIN32 21 GetTickCount() 22 #else 23 time(NULL) 24 #endif 25 ); 26 } 27 Generate() const28int CRandom::Generate() const { return rand(); } 29