libcommonc++
0.7
|
A random number generator. More...
#include <Random.h++>
Public Member Functions | |
Random () | |
Construct a new random number generator with a default seed which is based on a combination of the current thread ID, process ID, and system time. More... | |
Random (uint32_t seed) | |
Construct a new random number generator with the given seed. More... | |
~Random () | |
Destructor. More... | |
uint32_t | nextInt (uint32_t range) |
Generate a random integer. More... | |
double | nextDouble () |
Generate a random double value. More... | |
bool | getBytes (byte_t *buf, size_t len) |
Fill a byte buffer with random bytes. More... | |
A random number generator.
Random | ( | ) |
Construct a new random number generator with a default seed which is based on a combination of the current thread ID, process ID, and system time.
Random | ( | uint32_t | seed | ) |
Construct a new random number generator with the given seed.
~Random | ( | ) |
Destructor.
bool getBytes | ( | byte_t * | buf, |
size_t | len | ||
) |
Fill a byte buffer with random bytes.
buf | The buffer to fill. |
len | The length of the buffer. |
double nextDouble | ( | ) |
Generate a random double value.
uint32_t nextInt | ( | uint32_t | range | ) |
Generate a random integer.
range | The desired range of the value to be returned. |