Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Common/Random.cpp')
-rwxr-xr-xCPP/Common/Random.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/CPP/Common/Random.cpp b/CPP/Common/Random.cpp
new file mode 100755
index 00000000..f4a629c2
--- /dev/null
+++ b/CPP/Common/Random.cpp
@@ -0,0 +1,17 @@
+// Common/Random.cpp
+
+#include "StdAfx.h"
+
+#include <time.h>
+#include <stdlib.h>
+
+#include "Common/Random.h"
+
+void CRandom::Init(unsigned int seed)
+ { srand(seed); }
+
+void CRandom::Init()
+ { Init((unsigned int)time(NULL)); }
+
+int CRandom::Generate() const
+ { return rand(); }