GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::random::generator Class Reference

#include <graphlab/util/random.hpp>

List of all members.

Public Types

typedef boost::lagged_fibonacci607 real_rng_type
typedef boost::mt11213b discrete_rng_type
typedef boost::rand48 fast_discrete_rng_type

Public Member Functions

void seed ()
 Seed the generator using the default seed.
void nondet_seed ()
 Seed the generator nondeterministically.
void time_seed ()
 Seed the generator using the current time in microseconds.
void seed (size_t number)
 Seed the random number generator based on a number.
void seed (generator &other)
 Seed the generator using another generator.
template<typename NumType >
NumType uniform (const NumType min, const NumType max)
template<typename NumType >
NumType fast_uniform (const NumType min, const NumType max)
double gamma (const double alpha=double(1))
double gaussian (const double mean=double(0), const double stdev=double(1))
double normal (const double mean=double(0), const double stdev=double(1))
bool bernoulli (const double p=double(0.5))
bool fast_bernoulli (const double p=double(0.5))
template<typename Double >
size_t multinomial (const std::vector< Double > &prb)
template<typename Double >
size_t multinomial_cdf (const std::vector< Double > &cdf)
template<typename T >
std::vector< T > permutation (const size_t nelems)
template<typename T >
void shuffle (std::vector< T > &vec)
template<typename Iterator >
void shuffle (Iterator begin, Iterator end)

Detailed Description

The generator class is the base underlying type used to generate random numbers. User threads should use the functions provided in the random namespace.

Definition at line 100 of file random.hpp.


Member Function Documentation

template<typename NumType >
NumType graphlab::random::generator::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 165 of file random.hpp.

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

Generate a random number in the uniform real with range [min, max);

Definition at line 178 of file random.hpp.

double graphlab::random::generator::gaussian ( const double  mean = double(0),
const double  stdev = double(1) 
)
inline

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

Definition at line 191 of file random.hpp.

template<typename Double >
size_t graphlab::random::generator::multinomial ( const std::vector< Double > &  prb)
inline

Draw a random number from a multinomial

Definition at line 231 of file random.hpp.

template<typename Double >
size_t graphlab::random::generator::multinomial_cdf ( const std::vector< Double > &  cdf)
inline

Generate a draw from a multinomial using a CDF. This is slightly more efficient since normalization is not required and a binary search can be used.

Definition at line 256 of file random.hpp.

double graphlab::random::generator::normal ( const double  mean = double(0),
const double  stdev = double(1) 
)
inline

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

Definition at line 204 of file random.hpp.

template<typename T >
std::vector<T> graphlab::random::generator::permutation ( const size_t  nelems)
inline

Construct a random permutation

Definition at line 267 of file random.hpp.

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

Shuffle a standard vector

Definition at line 278 of file random.hpp.

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

Shuffle a range using the begin and end iterators

Definition at line 284 of file random.hpp.

template<typename NumType >
NumType graphlab::random::generator::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 152 of file random.hpp.


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