Turi Create
4.0
|
#include <core/random/random.hpp>
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)) |
double | cauchy (const double location=double(0), const double scale=double(1)) |
template<typename Double > | |
size_t | multinomial (const std::vector< Double > &prb) |
template<typename VecType , typename VType > | |
size_t | multinomial (const VecType &prb, VType norm) |
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) |
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 89 of file random.hpp.
|
inline |
Generate a cauchy random variable with zero location and unit scale.
Definition at line 207 of file random.hpp.
|
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 159 of file random.hpp.
|
inline |
Generate a random number in the uniform real with range [min, max);
Definition at line 172 of file random.hpp.
|
inline |
Generate a gaussian random variable with zero mean and unit variance.
Definition at line 185 of file random.hpp.
|
inline |
Draw a random number from a multinomial
Definition at line 237 of file random.hpp.
|
inline |
Draw a random number from a multinomial with normalizing constant provided.
Definition at line 260 of file random.hpp.
|
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 296 of file random.hpp.
|
inline |
Generate a gaussian random variable with zero mean and unit variance.
Definition at line 198 of file random.hpp.
|
inline |
Construct a random permutation
Definition at line 307 of file random.hpp.
|
inline |
Shuffle a standard vector
Definition at line 318 of file random.hpp.
|
inline |
Shuffle a range using the begin and end iterators
Definition at line 324 of file random.hpp.
|
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 146 of file random.hpp.