37int Random(
int min,
int max);
39unsigned int Random(
unsigned int min,
unsigned int max);
41long Random(
long min,
long max);
43unsigned long Random(
unsigned long min,
unsigned long max);
45char Random(
char min,
char max);
47float Random(
float min,
float max);
49double Random(
double min,
double max);
55namespace __rand_detail
57inline std::default_random_engine& GetRandomEngine()
59 static std::random_device device;
60 static std::default_random_engine engine(device());
65inline T RandomInt(T min, T max)
67 std::uniform_int_distribution<T> dist(min, max);
68 return dist(GetRandomEngine());
72inline T RandomReal(T min, T max)
74 std::uniform_real_distribution<T> dist(min, max);
75 return dist(GetRandomEngine());
79inline int Random(
int min,
int max)
81 return __rand_detail::RandomInt(min, max);
84inline unsigned int Random(
unsigned int min,
unsigned int max)
86 return __rand_detail::RandomInt(min, max);
89inline long Random(
long min,
long max)
91 return __rand_detail::RandomInt(min, max);
94inline unsigned long Random(
unsigned long min,
unsigned long max)
96 return __rand_detail::RandomInt(min, max);
99inline char Random(
char min,
char max)
101 return static_cast<char>(__rand_detail::RandomInt(
static_cast<int>(min),
static_cast<int>(max)));
104inline float Random(
float min,
float max)
106 return __rand_detail::RandomReal(min, max);
109inline double Random(
double min,
double max)
111 return __rand_detail::RandomReal(min, max);