Lumiera  0.pre.03
»edit your freedom«
RandomConcurrent_test::Experiment< GEN, threads > Struct Template Reference

Description

template<typename GEN, uint threads>
struct lib::test::RandomConcurrent_test::Experiment< GEN, threads >

Research setup to investigate concurrent access to a random generator.

From each test thread, the shared generator instance is invoked a huge number times (defined by NUM_INVOKES), thereby computing the mean value and checking for defect numbers outside the generator's definition range. This probe cycle is repeated several times (defined by NUM_SAMPLES) and the results are collected and evaluated afterwards to detect signs of a skewed distribution.

Template Parameters
GENa C++ compliant generator type
threadsnumber of threads to run in parallel
Remarks
Pseudo random number generation as such is not threadsafe, and pressing for concurrent access (as done here) will produce a corrupted internal generator state sooner or later. Under some circumstances however, theses glitches can be ignored, if quality of generated numbers actually does not matter.

Definition at line 114 of file random-concurrent-test.cpp.

Public Types

using ResVal = typename GEN::result_type
 

Public Member Functions

 Experiment (GEN &&fun)
 
void perform ()
 run the experiment series
 
void recordRun (double err, uint fails)
 

Public Attributes

ResVal expect = (GEN::max() - GEN::min()) / 2
 
GEN generator
 
bool isFailure {false}
 
const uint N = NUM_INVOKES
 
double percentGlitches {0.0}
 
double percentTilted {0.0}
 
const uint REPEATS = NUM_SAMPLES / threads
 
deque< tuple< double, uint > > results
 

Additional Inherited Members

- Static Public Member Functions inherited from Sync< CONF >
static MonitorgetMonitor (Sync const *forThis)
 
+ Inheritance diagram for RandomConcurrent_test::Experiment< GEN, threads >:
+ Collaboration diagram for RandomConcurrent_test::Experiment< GEN, threads >:

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