summaryrefslogtreecommitdiffstats
path: root/src/libs/7zip/win/CPP/Common/Random.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/7zip/win/CPP/Common/Random.cpp')
-rw-r--r--src/libs/7zip/win/CPP/Common/Random.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libs/7zip/win/CPP/Common/Random.cpp b/src/libs/7zip/win/CPP/Common/Random.cpp
new file mode 100644
index 000000000..4bd3fcf93
--- /dev/null
+++ b/src/libs/7zip/win/CPP/Common/Random.cpp
@@ -0,0 +1,26 @@
+// Common/Random.cpp
+
+#include "StdAfx.h"
+
+#include <stdlib.h>
+
+#ifndef _WIN32
+#include <time.h>
+#endif
+
+#include "Random.h"
+
+void CRandom::Init(unsigned int seed) { srand(seed); }
+
+void CRandom::Init()
+{
+ Init((unsigned int)
+ #ifdef _WIN32
+ GetTickCount()
+ #else
+ time(NULL)
+ #endif
+ );
+}
+
+int CRandom::Generate() const { return rand(); }