#include <Random.hpp>
|
| template<typename T > |
| static std::enable_if< std::is_floating_point< T >::value, T >::type | Real (const T min, const T max) |
| | Generates a random real between a range.
|
| |
| template<typename T > |
| static std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, T >::type | Int (const T min, const T max) |
| | Generates a random integer between a range.
|
| |
| static bool | Bool (const double p=0.5) |
| | Generates a random boolean value.
|
| |
| static std::string | Str (const std::size_t length) noexcept |
| | Generates a random string.
|
| |
| static std::vector< byte > | Bytes (const std::size_t length) noexcept |
| | Generates a random vector of bytes.
|
| |
| static void | Reseed () |
| |
| static std::default_random_engine & | GetEngine () noexcept |
| |
Definition at line 12 of file Random.hpp.
◆ Bool()
| static bool Random::Bool |
( |
const double |
p = 0.5 | ) |
|
|
inlinestatic |
Generates a random boolean value.
- Parameters
-
| p | Probability of true (50% by default) |
- Returns
- Returns a Random bool value, either 'true' or 'false'
Definition at line 49 of file Random.hpp.
◆ Bytes()
| static std::vector< byte > Random::Bytes |
( |
const std::size_t |
length | ) |
|
|
inlinestaticnoexcept |
Generates a random vector of bytes.
- Parameters
-
| length | length of the random vector to generate |
- Returns
- a random std::vector of bytes
Definition at line 90 of file Random.hpp.
◆ GetEngine()
| static std::default_random_engine & Random::GetEngine |
( |
| ) |
|
|
inlinestaticnoexcept |
◆ Int()
| static std::enable_if< std::is_integral< T >::value &&!std::is_same< T, bool >::value, T >::type Random::Int |
( |
const T |
min, |
|
|
const T |
max |
|
) |
| |
|
inlinestatic |
Generates a random integer between a range.
- Parameters
-
| min | minimum value of range (included in range) |
| max | maximum value of range (included in range) |
- Returns
- Random integer between min and max
Definition at line 38 of file Random.hpp.
◆ Real()
| static std::enable_if< std::is_floating_point< T >::value, T >::type Random::Real |
( |
const T |
min, |
|
|
const T |
max |
|
) |
| |
|
inlinestatic |
Generates a random real between a range.
- Parameters
-
| min | minimum value of range (included in range) |
| max | maximum value of range (included in range) |
- Returns
- Random real between min and max
Definition at line 24 of file Random.hpp.
◆ Reseed()
| static void Random::Reseed |
( |
| ) |
|
|
inlinestatic |
Reseeds the random engine with a new value
Definition at line 108 of file Random.hpp.
◆ Str()
| static std::string Random::Str |
( |
const std::size_t |
length | ) |
|
|
inlinestaticnoexcept |
Generates a random string.
- Parameters
-
| length | length of the random string to generate |
- Returns
- a random std::string a-zA-Z0-9
Definition at line 59 of file Random.hpp.
The documentation for this class was generated from the following file: