xref: /aosp_15_r20/external/lzma/CPP/Common/Random.cpp (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
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)15 void CRandom::Init(unsigned seed) { srand(seed); }
16 
Init()17 void CRandom::Init()
18 {
19   Init((unsigned)
20     #ifdef _WIN32
21     GetTickCount()
22     #else
23     time(NULL)
24     #endif
25     );
26 }
27 
Generate() const28 int CRandom::Generate() const { return rand(); }
29