Generates random numbers.
More...
#include <Random.hpp>
|
| Random () noexcept |
| Constructor.
|
|
| ~Random () noexcept |
| Destructor.
|
|
template<meta::is_arithmetic T> |
T | gen (const T min, const T max) noexcept |
| Generate a random number of type T.
|
|
template<meta::is_arithmetic T> |
sf::Vector2< T > | gen_vec2 (const sf::Vector2< T > &min, const sf::Vector2< T > &max) noexcept |
| Generate a random vec2.
|
|
template<meta::is_arithmetic T> |
sf::Vector3< T > | gen_vec3 (const sf::Vector3< T > &min, const sf::Vector3< T > &max) noexcept |
| Generate a random vec3.
|
|
|
std::random_device | m_rd |
| Randomizer device.
|
|
std::mt19937_64 | m_mt |
| Pseudo-random algorithm.
|
|
Generates random numbers.
Different than the function in that it doesnt create a new device each call. Essentially faster when needing lots of random numbers.
Definition at line 36 of file Random.hpp.
◆ Random()
galaxy::math::Random::Random |
( |
| ) |
|
|
noexcept |
◆ ~Random()
galaxy::math::Random::~Random |
( |
| ) |
|
|
noexcept |
◆ gen()
template<meta::is_arithmetic T>
T galaxy::math::Random::gen |
( |
const T | min, |
|
|
const T | max ) |
|
nodiscardnoexcept |
Generate a random number of type T.
- Template Parameters
-
T | The type of number to return. Must be arithmetic. |
- Parameters
-
min | Minimum number inclusive. |
max | Maximum number inclusive. |
- Returns
- Returns number of the same type as inputs.
Definition at line 105 of file Random.hpp.
◆ gen_vec2()
template<meta::is_arithmetic T>
sf::Vector2< T > galaxy::math::Random::gen_vec2 |
( |
const sf::Vector2< T > & | min, |
|
|
const sf::Vector2< T > & | max ) |
|
nodiscardnoexcept |
Generate a random vec2.
- Template Parameters
-
T | The type of number to return. Must be arithmetic. |
- Parameters
-
min | Minimum vec2 inclusive. |
max | Maximum vec2 inclusive. |
- Returns
- Pseudo-randomized vec2.
Definition at line 112 of file Random.hpp.
◆ gen_vec3()
template<meta::is_arithmetic T>
sf::Vector3< T > galaxy::math::Random::gen_vec3 |
( |
const sf::Vector3< T > & | min, |
|
|
const sf::Vector3< T > & | max ) |
|
nodiscardnoexcept |
Generate a random vec3.
- Template Parameters
-
T | The type of number to return. Must be arithmetic. |
- Parameters
-
min | Minimum vec3 inclusive. |
max | Maximum vec3 inclusive. |
- Returns
- Pseudo-randomized vec3.
Definition at line 118 of file Random.hpp.
◆ m_rd
std::random_device galaxy::math::Random::m_rd |
|
private |
Randomizer device.
Definition at line 96 of file Random.hpp.
◆ m_mt
std::mt19937_64 galaxy::math::Random::m_mt |
|
private |
Pseudo-random algorithm.
Definition at line 101 of file Random.hpp.
The documentation for this class was generated from the following files: