Namespaces | Functions

Random Number Generators

Namespaces

namespace  graphlab::random

Functions

void graphlab::random::seed ()
void graphlab::random::seed (size_t seed_value)
void graphlab::random::nondet_seed ()
void graphlab::random::time_seed ()
generator & graphlab::random::get_source ()
template<typename NumType >
NumType graphlab::random::uniform (const NumType min, const NumType max)
template<typename NumType >
NumType graphlab::random::fast_uniform (const NumType min, const NumType max)
double graphlab::random::rand01 ()
int graphlab::random::rand ()
double graphlab::random::gamma (const double alpha=double(1))
double graphlab::random::gaussian (const double mean=double(0), const double var=double(1))
bool graphlab::random::bernoulli (const double p=double(0.5))
bool graphlab::random::fast_bernoulli (const double p=double(0.5))
size_t graphlab::random::multinomial (const std::vector< double > &prb)
template<typename T >
void graphlab::random::shuffle (std::vector< T > &vec)
template<typename Iterator >
void graphlab::random::shuffle (Iterator begin, Iterator end)

Function Documentation

bool graphlab::random::bernoulli ( const double  p = double(0.5)  )  [inline]

Draw a sample from a bernoulli distribution

Definition at line 371 of file random.hpp.

bool graphlab::random::fast_bernoulli ( const double  p = double(0.5)  )  [inline]

Draw a sample form a bernoulli distribution using the faster generator

Definition at line 379 of file random.hpp.

template<typename NumType >
NumType graphlab::random::fast_uniform ( const NumType  min,
const NumType  max 
) [inline]

Generate a random number in the uniform real with range [min, max) or [min, max] if the number type is discrete.

Definition at line 330 of file random.hpp.

double graphlab::random::gamma ( const double  alpha = double(1)  )  [inline]

Generate a random number from a gamma distribution.

Definition at line 351 of file random.hpp.

double graphlab::random::gaussian ( const double  mean = double(0),
const double  var = double(1) 
) [inline]

Generate a gaussian random variable with zero mean and unit variance.

Definition at line 362 of file random.hpp.

generator& graphlab::random::get_source (  ) 

Get the local generator

size_t graphlab::random::multinomial ( const std::vector< double > &  prb  )  [inline]

Generate a draw from a multinomial. This function automatically normalizes as well.

Definition at line 388 of file random.hpp.

void graphlab::random::nondet_seed (  ) 

Seed all generators using a nondeterministic source

int graphlab::random::rand (  )  [inline]

Simulates the standard rand function as defined in cstdlib

Definition at line 344 of file random.hpp.

double graphlab::random::rand01 (  )  [inline]

Generate a random number between 0 and 1

Definition at line 338 of file random.hpp.

void graphlab::random::seed ( size_t  seed_value  ) 

Seed all generators using an integer

void graphlab::random::seed (  ) 

Seed all generators using the default seed

template<typename Iterator >
void graphlab::random::shuffle ( Iterator  begin,
Iterator  end 
)

Shuffle a range using the begin and end iterators

Definition at line 407 of file random.hpp.

template<typename T >
void graphlab::random::shuffle ( std::vector< T > &  vec  ) 

Shuffle a standard vector

Definition at line 398 of file random.hpp.

void graphlab::random::time_seed (  ) 

Seed all generators using the current time in microseconds

template<typename NumType >
NumType graphlab::random::uniform ( const NumType  min,
const NumType  max 
) [inline]

Generate a random number in the uniform real with range [min, max) or [min, max] if the number type is discrete.

Definition at line 320 of file random.hpp.