8#ifndef META_OCEAN_BASE_RANDOM_GENERATOR_H
9#define META_OCEAN_BASE_RANDOM_GENERATOR_H
82 inline unsigned int rand();
90 inline unsigned int lockedRand();
97 inline unsigned int seed()
const;
104 inline unsigned int initialSeed()
const;
120 static inline unsigned int nextRandomNumber(
unsigned int& seed);
126 static constexpr unsigned int randMax();
139 unsigned int initialSeed_ = (
unsigned int)(-1);
142 unsigned int seed_ = (
unsigned int)(-1);
164 initialSeed_(seed != 0u ? seed : 1u)
172 *
this = std::move(randomGenerator);
201 ocean_assert(
seed != 0u);
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a generator for random numbers.
Definition RandomGenerator.h:42
Lock lock_
Generator lock.
Definition RandomGenerator.h:145
static unsigned int threadAndTimeBasedSeed()
Returns a seed value based on the current time, the thread id, and a random value from RandomI.
unsigned int lockedRand()
Returns the next random number.
Definition RandomGenerator.h:180
unsigned int rand()
Returns the next random number.
Definition RandomGenerator.h:175
static constexpr unsigned int randMax()
Returns the maximal random value of this generator.
Definition RandomGenerator.h:211
unsigned int initialSeed_
The seed value which was used to initialize this random generator.
Definition RandomGenerator.h:139
unsigned int seed() const
Returns the current seed value of this object.
Definition RandomGenerator.h:187
unsigned int initialSeed() const
Returns the initial seed value which was used to initialize this random generator.
Definition RandomGenerator.h:192
RandomGenerator & operator=(RandomGenerator &&randomGenerator)
Move operator.
unsigned int seed_
Internal seed parameter used for random number generation, changes whenever a new random number is ge...
Definition RandomGenerator.h:142
RandomGenerator(RandomGenerator *optionalGenerator)
Creates a new random generator and optional initializes the internal parameter by a random value prov...
RandomGenerator()
Creates a new random generator and initializes the internal parameter with the random value of the st...
static unsigned int nextRandomNumber(unsigned int &seed)
Generates a new random number using the xorshift32 algorithm.
Definition RandomGenerator.h:197
This class implements a scoped lock object for recursive lock objects.
Definition Lock.h:147
The namespace covering the entire Ocean framework.
Definition Accessor.h:15