From 81bb6873f1c0291fecbf6e429ad15ac3db66a4c0 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 12 Mar 2024 22:07:03 +0100 Subject: Legal notices updated Rename contrib -> third-party intendes to express the origin and purpose of that part of the code better. I plan to readd contrib/ again but with more in-project things like bash-completions, dev workflow scripts etc. --- third-party/Opcode/Ice/IceRandom.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 third-party/Opcode/Ice/IceRandom.cpp (limited to 'third-party/Opcode/Ice/IceRandom.cpp') diff --git a/third-party/Opcode/Ice/IceRandom.cpp b/third-party/Opcode/Ice/IceRandom.cpp new file mode 100644 index 0000000..305721d --- /dev/null +++ b/third-party/Opcode/Ice/IceRandom.cpp @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Contains code for random generators. + * \file IceRandom.cpp + * \author Pierre Terdiman + * \date August, 9, 2001 + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Precompiled Header +#include "StdAfx.h" + +using namespace IceCore; + +void IceCore:: SRand(udword seed) +{ + srand(seed); +} + +udword IceCore::Rand() +{ + return rand(); +} + + +static BasicRandom gRandomGenerator(42); + +udword IceCore::GetRandomIndex(udword max_index) +{ + // We don't use rand() since it's limited to RAND_MAX + udword Index = gRandomGenerator.Randomize(); + return Index % max_index; +} + -- cgit v1.1