Lumiera  0.pre.03
»edit your freedom«
RandomConcurrent_test Class Reference

Description

Test:
demonstrate simple access to random number generation, as well as the setup of controlled random number sequences.
See also
random.hpp

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

Classes

struct  Experiment
 Research setup to investigate concurrent access to a random generator. More...
 

Private Member Functions

void benchmark_random_gen ()
 
void investigate_concurrentAccess ()
 
virtual void run (Arg arg)
 

Member Function Documentation

◆ benchmark_random_gen()

void benchmark_random_gen ( )
inlineprivate
Test:
microbenchmark of various random number generators
Remarks
typical values
  • rand() (trinomial generator) : 15ns / 10ns (O3)
  • Mersenne twister 64bit : 55ns / 25ns (O3)
  • reading /dev/urandom : 480ns / 470 (O3)

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

References lib::test::microBenchmark(), lib::test::anonymous_namespace{random-concurrent-test.cpp}::NUM_INVOKES, and lib::rani().

+ Here is the call graph for this function:

◆ investigate_concurrentAccess()

void investigate_concurrentAccess ( )
inlineprivate
Test:
examine behaviour of PRNG under concurrency stress
  • running a 32bit generator single threaded should not trigger alarms
  • while under concurrent pressure several defect numbers should be produced
  • even the 64bit generator will show uneven distribution due to corrupted state
  • the 32bit generator capped to its valid range exhibits skew only occasionally
See also
lib::CappedGen

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

References lib::defaultGen, RandomConcurrent_test::Experiment< GEN, threads >::perform(), and RandomSequencer< GEN >::uni().

+ Here is the call graph for this function:
+ Inheritance diagram for RandomConcurrent_test:
+ Collaboration diagram for RandomConcurrent_test:

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