Stride Reference Manual  - generated for commit 9643b11
stride::util::RnMan Class Reference

#include <RnMan.h>

Collaboration diagram for stride::util::RnMan:
Collaboration graph

Public Member Functions

 RnMan ()
 Default constructor builds empty (uninitialized) manager. More...
 
 RnMan (const RnInfo &info)
 Initializing Constructor. More...
 
bool operator== (const RnMan &other)
 Equality of states. More...
 
RnInfo GetInfo () const
 Return the state of the random engines. More...
 
std::function< double()> GetUniform01Generator (unsigned int i=0U)
 Return a generator for uniform doubles in [0, 1[ using i-th random stream. More...
 
std::function< int()> GetUniformIntGenerator (int a, int b, unsigned int i=0U)
 Return a generator for uniform ints in [a, b[ (a < b) using i-th random stream. More...
 
std::function< int()> GetDiscreteGenerator (const std::vector< double > &weights, unsigned int i=0U)
 Return generator for ints [0, n-1[ with non-negative weights p_j (i=0,..,n-1) using i-th random stream. More...
 
bool MakeWeightedCoinFlip (double fraction, unsigned int i=0U)
 Make weighted coin flip: <fraction> of the flips need to come up true. More...
 
void Initialize (const RnInfo &info)
 Initalize with data in Info. More...
 
bool IsEmpty () const
 Is this een empty (i.e. non-initialized Rn)? More...
 
void Shuffle (std::vector< unsigned int > &indices, unsigned int i)
 Random shuffle of vector of int indices using i-th random stream. More...
 

Private Attributes

std::shared_ptr< RnEngine > m_rn
 

Detailed Description

Definition at line 38 of file RnMan.h.

Constructor & Destructor Documentation

stride::util::RnMan::RnMan ( )

Default constructor builds empty (uninitialized) manager.

Definition at line 64 of file RnMan.cpp.

stride::util::RnMan::RnMan ( const RnInfo info)
explicit

Initializing Constructor.

Definition at line 66 of file RnMan.cpp.

Member Function Documentation

bool stride::util::RnMan::operator== ( const RnMan other)

Equality of states.

Definition at line 68 of file RnMan.cpp.

References m_rn.

RnInfo stride::util::RnMan::GetInfo ( ) const

Return the state of the random engines.

Definition at line 70 of file RnMan.cpp.

References m_rn.

std::function< double()> stride::util::RnMan::GetUniform01Generator ( unsigned int  i = 0U)

Return a generator for uniform doubles in [0, 1[ using i-th random stream.

Definition at line 72 of file RnMan.cpp.

References m_rn.

Referenced by stride::PublicHealthAgency::PerformCaseFinding().

Here is the caller graph for this function:

std::function< int()> stride::util::RnMan::GetUniformIntGenerator ( int  a,
int  b,
unsigned int  i = 0U 
)

Return a generator for uniform ints in [a, b[ (a < b) using i-th random stream.

Definition at line 74 of file RnMan.cpp.

References m_rn.

Referenced by stride::DiseaseSeeder::Seed(), and stride::SurveySeeder::Seed().

Here is the caller graph for this function:

std::function< int()> stride::util::RnMan::GetDiscreteGenerator ( const std::vector< double > &  weights,
unsigned int  i = 0U 
)

Return generator for ints [0, n-1[ with non-negative weights p_j (i=0,..,n-1) using i-th random stream.

Definition at line 79 of file RnMan.cpp.

References m_rn.

bool stride::util::RnMan::MakeWeightedCoinFlip ( double  fraction,
unsigned int  i = 0U 
)

Make weighted coin flip: <fraction> of the flips need to come up true.

Definition at line 84 of file RnMan.cpp.

References m_rn.

void stride::util::RnMan::Initialize ( const RnInfo info)

Initalize with data in Info.

Definition at line 93 of file RnMan.cpp.

References m_rn.

bool stride::util::RnMan::IsEmpty ( ) const

Is this een empty (i.e. non-initialized Rn)?

Definition at line 95 of file RnMan.cpp.

References m_rn.

void stride::util::RnMan::Shuffle ( std::vector< unsigned int > &  indices,
unsigned int  i 
)

Random shuffle of vector of int indices using i-th random stream.

Definition at line 97 of file RnMan.cpp.

References m_rn.

Member Data Documentation

std::shared_ptr<RnEngine> stride::util::RnMan::m_rn
private

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