#include <RandomGenerator.hpp>
Public Types | |
using | result_type = uint_fast32_t |
Public Member Functions | |
template<class T > | |
RandomGenerator (Instance *inst, RandomId id, T const &identity) | |
Instance * | instance () const |
void | reset () |
result_type | operator() () |
Static Public Member Functions | |
static constexpr result_type | max () |
static constexpr result_type | min () |
Detailed Description
Meant to be used with standard library Distributions from std::random, but operator() can be used as well. Each instantiation of this resets the sequence. The sequence starts on value determined by seed of RandomId stored in RandomSystem and hash of identity given in constructor. If we want to generate one value, we need to instantiate RandomGenerator and use it once. If we want to generate a sequence, we need to keep it instantiated and keep using it. If we want a seqnece but are unable to keep it instantiated, we can pass the order of generated number as part of the identity.
Definition at line 18 of file RandomGenerator.hpp.
Member Typedef Documentation
◆ result_type
using iv::RandomGenerator::result_type = uint_fast32_t |
Definition at line 28 of file RandomGenerator.hpp.
Constructor & Destructor Documentation
◆ RandomGenerator()
iv::RandomGenerator::RandomGenerator | ( | Instance * | inst, |
RandomId | id, | ||
T const & | identity | ||
) |
Definition at line 5 of file RandomGenerator.inl.
Member Function Documentation
◆ instance()
Instance * iv::RandomGenerator::instance | ( | ) | const |
Definition at line 6 of file RandomGenerator.cpp.
◆ reset()
void iv::RandomGenerator::reset | ( | ) |
Definition at line 16 of file RandomGenerator.cpp.
◆ operator()()
RandomGenerator::result_type iv::RandomGenerator::operator() | ( | ) |
Definition at line 11 of file RandomGenerator.cpp.
◆ max()
|
inlinestaticconstexpr |
Definition at line 30 of file RandomGenerator.hpp.
◆ min()
|
inlinestaticconstexpr |
Definition at line 31 of file RandomGenerator.hpp.
The documentation for this class was generated from the following files:
- ivorium_systems/RandomSystem/RandomGenerator.hpp
- ivorium_systems/RandomSystem/RandomGenerator.cpp
- ivorium_systems/RandomSystem/RandomGenerator.inl