Turi Create  4.0
turi::random Namespace Reference

Classes

class  alias_sampler
 
class  generator
 

Functions

uint64_t pure_random_seed ()
 
void seed ()
 
void seed (size_t seed_value)
 
void nondet_seed ()
 
void time_seed ()
 
generatorget_source ()
 
template<typename NumType >
NumType uniform (const NumType min, const NumType max)
 
template<typename NumType >
NumType fast_uniform (const NumType min, const NumType max)
 
double rand01 ()
 
int rand ()
 
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))
 
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 VecLike , typename Double >
size_t multinomial (const VecLike &prb, Double 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)
 
void pdf2cdf (std::vector< double > &pdf)
 

Detailed Description

A collection of thread safe random number routines. Each thread is assigned its own generator however assigning a seed affects all current and future generators.

Function Documentation

◆ pdf2cdf()

void turi::random::pdf2cdf ( std::vector< double > &  pdf)

Converts a discrete PDF into a CDF

◆ pure_random_seed()

uint64_t turi::random::pure_random_seed ( )

A function that returns a new random seed value every time it's called.