File rng.hpp¶
-
class RNG¶
- #include <rng.hpp>
Implements a fast random number generator using 32 bit XOR shifts (see “Xorshift RNGs”, Marsaglia, 2003).
Public Functions
-
RNG(uint32 randomState)¶
- Parameters:
randomState – The seed to be used by the random number generator. Must be at least 1
-
uint32 randomInt(uint32 min, uint32 max)¶
Generates and returns a random number in [min, max).
- Parameters:
min – The minimum number (inclusive)
max – The maximum number (exclusive)
- Returns:
The random number that has been generated
-
bool randomBool()¶
Generates and returns a random boolean.
- Returns:
The random boolean that has been generated
-
RNG(uint32 randomState)¶
-
class RNGConfig¶
- #include <rng.hpp>
Allows to configure random number generators.
Public Functions
-
RNGConfig()¶
-
uint32 getRandomState() const¶
Returns the seed that is used by random number generators.
- Returns:
The seed that is used
-
RNGConfig &setRandomState(uint32 randomState)¶
Sets the seed that should be used by random number generators.
- Parameters:
randomState – The seed that should be used. Must be at least 1
-
std::unique_ptr<RNGFactory> createRNGFactory() const¶
Creates and returns a new object of type
RNGFactoryaccording to this configuration.- Returns:
An unique pointer to an object of type
RNGFactorythat has been created
-
RNGConfig()¶