A pseudo-random number generator.
This class has member functions for generating random numbers.
Definition at line 63 of file ge211_random.h.
Public Member Functions | |
template<class T > | |
T | up_to (T max) |
Returns a random T between 0 (inclusive) and max (exclusive). More... | |
template<class T > | |
T | between (T min, T max) |
Returns a random T between min and max . More... | |
bool | random_bool (double ptrue=0.5) |
Returns a random bool that is true with probability ptrue . More... | |
|
inline |
Returns a random T
between min
and max
.
The right bound is inclusive for integral types but exclusive for floating point types. The left bound is always inclusive.
Example:
Definition at line 95 of file ge211_random.h.
bool random_bool | ( | double | ptrue = 0.5 | ) |
Returns a random bool
that is true
with probability ptrue
.
Definition at line 22 of file ge211_random.cpp.
|
inline |
Returns a random T
between 0 (inclusive) and max
(exclusive).
Example:
Definition at line 77 of file ge211_random.h.