#include <random.hpp>
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 var=double(1)) |
| bool | bernoulli (const double p=double(0.5)) |
| bool | fast_bernoulli (const double p=double(0.5)) |
| size_t | multinomial (const std::vector< double > &prb) |
| template<typename T > | |
| void | shuffle (std::vector< T > &vec) |
| template<typename Iterator > | |
| void | shuffle (Iterator begin, Iterator end) |
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 95 of file random.hpp.
| 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 156 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 169 of file random.hpp.
| double graphlab::random::generator::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 181 of file random.hpp.
| size_t graphlab::random::generator::multinomial | ( | const std::vector< double > & | prb | ) | [inline] |
Draw a random number from a multinomial
Definition at line 210 of file random.hpp.
| void graphlab::random::generator::shuffle | ( | Iterator | begin, | |
| Iterator | end | |||
| ) | [inline] |
Shuffle a range using the begin and end iterators
Definition at line 239 of file random.hpp.
| void graphlab::random::generator::shuffle | ( | std::vector< T > & | vec | ) | [inline] |
Shuffle a standard vector
Definition at line 233 of file random.hpp.
| 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 143 of file random.hpp.
1.7.1