diff options
Diffstat (limited to 'src/common/mt_rand.cpp')
-rw-r--r-- | src/common/mt_rand.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/common/mt_rand.cpp b/src/common/mt_rand.cpp index 91ae2e4..651620a 100644 --- a/src/common/mt_rand.cpp +++ b/src/common/mt_rand.cpp @@ -45,9 +45,10 @@ // */ -#include <time.h> #include "mt_rand.hpp" +#include <ctime> + #define N 624 // length of state vector #define M 397 // a period parameter #define K 0x9908B0DFU // a magic constant @@ -57,9 +58,12 @@ #define loBits(u) ((u) & 0x7FFFFFFFU) // mask the highest bit of u #define mixBits(u, v) (hiBit(u)|loBits(v)) // move hi bit of u to hi bit of v -static uint32_t state[N+1]; // state vector the +1 is needed due to the coding -static uint32_t *next; // next random value is computed from here -static int left = -1; // can *next++ this many times before reloading +static +uint32_t state[N+1]; // state vector the +1 is needed due to the coding +static +uint32_t *next; // next random value is computed from here +static +int left = -1; // can *next++ this many times before reloading void mt_seed(uint32_t seed) { |