From f19f813537c7aea1c20749c914e756b54a9c3cf5 Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Mon, 27 Dec 2021 00:00:00 +0000 Subject: '21.07' --- CPP/Common/Random.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 CPP/Common/Random.cpp (limited to 'CPP/Common/Random.cpp') diff --git a/CPP/Common/Random.cpp b/CPP/Common/Random.cpp new file mode 100644 index 0000000..fbdb8c9 --- /dev/null +++ b/CPP/Common/Random.cpp @@ -0,0 +1,28 @@ +// Common/Random.cpp + +#include "StdAfx.h" + +#include + +#ifndef _WIN32 +#include +#else +#include "MyWindows.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(); } -- cgit v1.2.3-55-g6feb