Random-related methods.
More...
#include <Random.h>
|
| Random_ () |
|
| Random_ (RandomGen &gen) |
| Construct with random generator to use for all methods. More...
|
|
void | setGen (RandomGen &gen) |
| Set random generator to use for all methods. More...
|
|
RandomGen & | getGen () const |
| Get random generator. More...
|
|
bool | boolean () const |
| Generate random bool true/false. More...
|
|
template<class T > |
void | sample (const vector< T > &list, szt count, vector< T > &sample) const |
| Randomly choose count items from the list with replacement, so an item can be sampled more than once. Result is stored in sample. More...
|
|
template<class T > |
void | choose (const vector< T > &list, szt count, vector< T > &chosen, vector< szt > &unchosen) const |
| Randomly choose count items from a list without replacement, so an item can't be chosen more than once. Results stored in chosen , and unchosen (unchosen indices). More...
|
|
template<class T > |
void | shuffle (vector< T > &list) const |
| Randomly permute a list. The entire list will be shuffled into a random order. All permutations have equal probability. More...
|
|
Vec3 | dir () const |
| Generate a random unit direction. More...
|
|
Vec3 | dir (const Vec3 &dir, Real dirVarMin, Real dirVarMax) const |
| Generate a random unit direction parallel to dir with an angular spread of dirVarMin to dirVarMax (radians) More...
|
|
Vec2 | dir2d () const |
| Generate a 2D random unit direction. More...
|
|
|
template<class Range > |
static tuple< Real, Real, Real > | mean (const Range &samples) |
| Estimate the sample mean, returns a tuple of (mean, min, max) More...
|
|
template<class Range > |
static Real | variance (const Range &samples, Real mean) |
| Estimate the sample variance given the mean. This is the unbiased estimator (mean over all possible samples is the population variance) More...
|
|
static Real | stdDev (Real variance) |
| Calculate the standard deviation given the variance. More...
|
|
static Real | stdErr (Real sampleSize, Real stddev) |
| Calculate the standard error of the mean. This is how well the sample mean appoximates the population mean. The larger the sample, the smaller the error. More...
|
|
template<class Range > |
static DistStats | stats (const Range &samples) |
| Calculate distribution statistics. More...
|
|
template<class Real>
class honey::Random_< Real >
Random-related methods.
Construct with random generator to use for all methods.
Generate random bool true/false.
template<class Real>
template<class T >
void honey::Random_< Real >::choose |
( |
const vector< T > & |
list, |
|
|
szt |
count, |
|
|
vector< T > & |
chosen, |
|
|
vector< szt > & |
unchosen |
|
) |
| const |
|
inline |
Randomly choose count items from a list without replacement, so an item can't be chosen more than once. Results stored in chosen
, and unchosen
(unchosen indices).
Generate a random unit direction.
Generate a random unit direction parallel to dir with an angular spread of dirVarMin to dirVarMax (radians)
Generate a 2D random unit direction.
template<class Real>
template<class Range >
Estimate the sample mean, returns a tuple of (mean, min, max)
template<class Real>
template<class T >
Randomly choose count items from the list with replacement, so an item can be sampled more than once. Result is stored in sample.
Set random generator to use for all methods.
template<class Real>
template<class T >
Randomly permute a list. The entire list will be shuffled into a random order. All permutations have equal probability.
template<class Real>
template<class Range >
Calculate distribution statistics.
Calculate the standard deviation given the variance.
Calculate the standard error of the mean. This is how well the sample mean appoximates the population mean. The larger the sample, the smaller the error.
template<class Real>
template<class Range >
Estimate the sample variance given the mean. This is the unbiased estimator (mean over all possible samples is the population variance)
The documentation for this class was generated from the following files: