ddc
Public Attributes | List of all members
DDCRandom Class Reference

thread-safe pseudo-random number stream using drand48() & friends More...

#include <ddcRandom.h>

Public Member Functions

Constructors etc.
 DDCRandom (unsigned int seed=0)
 Constructor given state. More...
 
void set_seed (unsigned int seed=0)
 set internal seed More...
 
 ~DDCRandom (void)
 Default destructor. More...
 
API
double random_d (void)
 returns a pseudo-random double in the range [0,1) More...
 
long random_l (void)
 returns a pseudo-random long in the range [-2**31,2**31) More...
 
long random_n (void)
 returns a pseudo-random unsigned long in the range [0,2**31) More...
 

Public Attributes

unsigned int m_seed
 underlying random seed for POSIX.1 random numbers using rand_r() or srand()+rand() hack More...
 
unsigned short m_state [3]
 underlying computation state (defaults to {m_seed,m_seed,m_seed}) for jrand48() & friends More...
 

Detailed Description

thread-safe pseudo-random number stream using drand48() & friends

Constructor & Destructor Documentation

◆ DDCRandom()

DDCRandom::DDCRandom ( unsigned int  seed = 0)
inline

Constructor given state.

◆ ~DDCRandom()

DDCRandom::~DDCRandom ( void  )
inline

Default destructor.

Member Function Documentation

◆ set_seed()

void DDCRandom::set_seed ( unsigned int  seed = 0)
inline

set internal seed

Referenced by CConcSession::WorkerClone().

Here is the caller graph for this function:

◆ random_d()

double DDCRandom::random_d ( void  )
inline

returns a pseudo-random double in the range [0,1)

◆ random_l()

long DDCRandom::random_l ( void  )
inline

returns a pseudo-random long in the range [-2**31,2**31)

Referenced by random_n().

Here is the caller graph for this function:

◆ random_n()

long DDCRandom::random_n ( void  )
inline

returns a pseudo-random unsigned long in the range [0,2**31)

References random_l().

Here is the call graph for this function:

Member Data Documentation

◆ m_seed

unsigned int DDCRandom::m_seed

underlying random seed for POSIX.1 random numbers using rand_r() or srand()+rand() hack

◆ m_state

unsigned short DDCRandom::m_state[3]

underlying computation state (defaults to {m_seed,m_seed,m_seed}) for jrand48() & friends


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