34 #if defined(__APPLE__)
36 #define LOCK_GLOBAL_MUTEX(m) std::lock_guard<std::mutex> lock(m)
38 #define THREAD_LOCAL thread_local
39 #define LOCK_GLOBAL_MUTEX(m) (void)m
52 g_random_engine.seed(s);
58 return uniform_int_distribution<uint32_t>(0, maximum-1)(g_random_engine);
60 return uniform_int_distribution<uint32_t>()(g_random_engine);
67 return uniform_int_distribution<int64_t>(0, maximum-1)(g_random_engine);
69 return uniform_int_distribution<int64_t>()(g_random_engine);
74 return uniform_real_distribution<>()(g_random_engine);
80 uniform_int_distribution<uint32_t> di(0, maximum-1);
81 return chrono::milliseconds(di(g_random_engine));
static uint32_t number32(uint32_t maximum=0)
Returns a random 32-bit unsigned integer.
static int64_t number64(int64_t maximum=0)
Returns a random 64-bit unsigned integer.
Compatibility Macros for C/C++.
#define LOCK_GLOBAL_MUTEX(m)
static double uniform01()
Returns a random double.
Random number generator for int32, int64, double and ascii arrays.
static std::chrono::milliseconds duration_millis(uint32_t maximum)
Returns a random millisecond duration.
static void seed(unsigned int s)
Sets the seed of the random number generator.