![]() |
xtd - Reference Guide
0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness. More...
#include <random.h>
Public Member Functions | |
random () | |
Initializes a new instance of the random class, using a default generated seed value. More... | |
random (uint32_t seed) | |
Initializes a new instance of the random class, using a specified seed value. More... | |
random (std::random_device &random_device) | |
Initializes a new instance of the random class, using a specified random device value. More... | |
virtual int32_t | next () const |
Returns a nonnegative random number. More... | |
template<typename value_t > | |
value_t | next () const |
Returns a nonnegative random number. More... | |
virtual int32_t | next (int32_t max_value) const |
Returns a nonnegative random number less than the specified maximum. More... | |
template<typename value_t > | |
value_t | next (value_t max_value) const |
Returns a nonnegative random number less than the specified maximum. More... | |
virtual int32_t | next (int32_t min_value, int32_t max_value) const |
Returns a random number within a specified range. More... | |
template<typename value_t > | |
value_t | next (value_t min_value, value_t max_value) const |
Returns a random number within a specified range. More... | |
virtual void | next_bytes (std::vector< uint8_t > &buffer) const |
Fills the elements of a specified array of bytes with random numbers. More... | |
virtual void | next_bytes (uint8_t *buffer, size_t buffer_size) const |
Fills the elements of a specified array of bytes with random numbers. More... | |
virtual double | next_double () const |
Returns a random number between 0.0 and 1.0. More... | |
template<typename value_t > | |
void | next_values (std::vector< value_t > &buffer) const |
Fills the elements of a specified array of bytes with random numbers. More... | |
template<typename value_t > | |
void | next_values (value_t *buffer, size_t buffer_size) const |
Fills the elements of a specified array of bytes with random numbers. More... | |
Protected Member Functions | |
virtual double | sample () const |
Returns a random number between 0.0 and 1.0. More... | |
Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness.