#include <seed.hpp>

Public Member Functions

 seed ()=delete
 
 seed (const seed &)=delete
 
seedoperator= (const seed &)=delete
 

Static Public Member Functions

static std::mt19937_64 & get_generator ()
 
static void set_seed (const arma::arma_rng::seed_type seed)
 
static void set_random_seed ()
 
static arma::arma_rng::seed_type get_seed ()
 

Static Protected Attributes

static arma::arma_rng::seed_type seed_
 
static std::mt19937_64 generator_
 

Constructor & Destructor Documentation

◆ seed() [1/2]

pass::seed::seed ( )
delete

The random number generator should act as a singleton, no need for default constructors.

Here is the caller graph for this function:

◆ seed() [2/2]

pass::seed::seed ( const seed )
delete

Member Function Documentation

◆ get_generator()

std::mt19937_64 & pass::seed::get_generator ( )
static

The std::mersenne_twister_engine requires an l-value (a reference in this case) instead of an r-value. Otherwise, calls like std::uniform_real_distribution<double>(0, 1)(seed::get_generator()) won't compile.

◆ get_seed()

arma::arma_rng::seed_type pass::seed::get_seed ( )
static

Gets the seed if you want to reproduce the experiment

◆ operator=()

seed& pass::seed::operator= ( const seed )
delete

◆ set_random_seed()

void pass::seed::set_random_seed ( )
static

Initialise Armadillo's generator with any random seed. This seed will be overwritten later on, no need to store it.

For programs using MPI, each node needs to seeded differently in order to avoid a degeneration of the random number generator, due to synchronisation. Basically, we generated as much random numbers as there are nodes and seed the i-th node by the i-th generated random number.

Without MPI, using the first random number generated by Armadillo's generator as seed is sufficient.

Here is the call graph for this function:

◆ set_seed()

void pass::seed::set_seed ( const arma::arma_rng::seed_type  seed)
static

Seeding C++'s and Armadillo's generator.

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

Member Data Documentation

◆ generator_

std::mt19937_64 pass::seed::generator_
staticprotected

◆ seed_

arma::arma_rng::seed_type pass::seed::seed_
staticprotected

The documentation for this class was generated from the following files:
  • /Users/romeo/Desktop/PASS/include/pass_bits/helper/seed.hpp
  • /Users/romeo/Desktop/PASS/src/helper/seed.cpp