Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
RandomSequencer< GEN > Class Template Reference

#include "lib/random.hpp"

Description

template<class GEN>
class lib::RandomSequencer< GEN >

Access point to a selection of random number sources.

For each kind of performance or usage, a common execution scheme is established to initiate generated number sequences, allowing for seemingly random yet reproducible behaviour — or for actually contingent behaviour when necessary. Client code should rely on Dependency-Injection or the static accessors.

Definition at line 64 of file random.hpp.

Classes

class  Seed
 

Public Member Functions

 RandomSequencer (SeedNucleus &)
 Build new generator, drawing seed from a virtual seed source.
 
template<class G >
 RandomSequencer (RandomSequencer< G > &)
 Build new generator, drawing a seed from given parent generator.
 
int i (uint bound=_iBOUND())
 drop-in replacement for rand() % bound
 
int i32 ()
 random number from full integer range (incl. negative values)
 
uint64_t u64 ()
 random 64bit number from full range.
 
double uni ()
 random double drawn from interval [0.0 ... 1.0[
 
double range (double start, double bound)
 random double from designated interval (upper bound excluded)
 
double normal (double mean=0.0, double stdev=1.0)
 normal distribution (gaussian)
 
HashVal hash ()
 non-zero hash value from full 64bit range
 
template<class DIST >
auto distribute (DIST)
 generic adapter: draw next number to use the given distribution
 
void reseed (SeedNucleus &)
 inject controlled randomisation
 

Private Attributes

GEN generator_
 

Constructor & Destructor Documentation

◆ RandomSequencer() [1/2]

template<class GEN >
RandomSequencer ( SeedNucleus nucleus)
inline

Build new generator, drawing seed from a virtual seed source.

Definition at line 174 of file random.hpp.

◆ RandomSequencer() [2/2]

template<class GEN >
template<class G >
RandomSequencer ( RandomSequencer< G > &  parent)
inline

Build new generator, drawing a seed from given parent generator.

Definition at line 181 of file random.hpp.

Member Function Documentation

◆ i()

template<class GEN >
int i ( uint  bound = _iBOUND())
inline

drop-in replacement for rand() % bound

Parameters
boundupper bound (exclusive!)

Definition at line 205 of file random.hpp.

Referenced by CallQueue_test::Worker::Worker(), and lib::rani().

+ Here is the caller graph for this function:

◆ i32()

template<class GEN >
int i32 ( )
inline

random number from full integer range (incl. negative values)

Definition at line 216 of file random.hpp.

Referenced by Random_test::verify_reproducibleSequence().

+ Here is the caller graph for this function:

◆ u64()

◆ uni()

template<class GEN >
double uni ( )
inline

random double drawn from interval [0.0 ... 1.0[

Definition at line 232 of file random.hpp.

Referenced by LimitedRandomGenerate< max >::defaultSrc(), RandomConcurrent_test::investigate_concurrentAccess(), ParameterRange< CONF >::perform(), NodeDevel_test::processing_combineFrames(), NodeDevel_test::testRand_buildMixNode(), and NodeBase_test::verify_TurnoutSystem().

+ Here is the caller graph for this function:

◆ range()

template<class GEN >
double range ( double  start,
double  bound 
)
inline

random double from designated interval (upper bound excluded)

Definition at line 239 of file random.hpp.

Referenced by lib::ranRange().

+ Here is the caller graph for this function:

◆ normal()

template<class GEN >
double normal ( double  mean = 0.0,
double  stdev = 1.0 
)
inline

normal distribution (gaussian)

Definition at line 246 of file random.hpp.

Referenced by lib::ranNormal().

+ Here is the caller graph for this function:

◆ hash()

template<class GEN >
HashVal hash ( )
inline

non-zero hash value from full 64bit range

Definition at line 253 of file random.hpp.

Referenced by lib::ranHash(), and steam::engine::test::anonymous_namespace{testframe.cpp}::stampHeader().

+ Here is the caller graph for this function:

◆ distribute()

template<class GEN >
template<class DIST >
auto distribute ( DIST  distribution)
inline

generic adapter: draw next number to use the given distribution

Definition at line 197 of file random.hpp.

Referenced by steam::engine::test::anonymous_namespace{testframe.cpp}::drawSeed().

+ Here is the caller graph for this function:

◆ reseed()

template<class GEN >
void reseed ( SeedNucleus nucleus)
inline

inject controlled randomisation

Definition at line 188 of file random.hpp.

References SeedNucleus::getSeed().

Referenced by lib::randomiseRandomness(), and Test::seedRand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ generator_

template<class GEN >
GEN generator_
private

Definition at line 66 of file random.hpp.

+ Inheritance diagram for RandomSequencer< GEN >:
+ Collaboration diagram for RandomSequencer< GEN >:

The documentation for this class was generated from the following file: