GestureRecognitionToolkit  Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Random Class Reference

Public Member Functions

 Random (unsigned long long seed=0)
 
 ~Random ()
 
void setSeed (unsigned long long seed=0)
 
int getRandomNumberInt (int minRange, int maxRange)
 
int getRandomNumberWeighted (const Vector< int > &values, const VectorFloat &weights)
 
int getRandomNumberWeighted (Vector< IndexedDouble > weightedValues)
 
int getRandomNumberWeighted (Vector< IndexedDouble > &weightedValues, VectorFloat &x)
 
Float getRandomNumberUniform (Float minRange=0.0, Float maxRange=1.0)
 
Float getRandomNumberGauss (Float mu=0.0, Float sigma=1.0)
 
VectorFloat getRandomVectorUniform (UINT numDimensions, Float minRange=0.0, Float maxRange=1.0)
 
VectorFloat getRandomVectorGauss (UINT numDimensions, Float mu=0.0, Float sigma=1.0)
 
Vector< unsigned int > getRandomSubset (const unsigned int startRange, const unsigned int endRange, const unsigned int subsetSize)
 

Detailed Description

Definition at line 40 of file Random.h.

Constructor & Destructor Documentation

Random::Random ( unsigned long long  seed = 0)
inline

Default constructor. Sets the random seed. If no seed is supplied then the seed will be set using the current system time.

Parameters
seedsets the current seed, If no seed is supplied then the seed will be set using the current system time

Definition at line 48 of file Random.h.

Random::~Random ( )
inline

Default destructor.

Definition at line 59 of file Random.h.

Member Function Documentation

Float Random::getRandomNumberGauss ( Float  mu = 0.0,
Float  sigma = 1.0 
)
inline

Gets a random Float, using a Gaussian distribution with mu 0 and sigma 1.0

Parameters
muthe mu parameter for the Gaussian distribution
sigmathe sigma parameter for the Gaussian distribution
Returns
returns a Float from the Gaussian distribution controlled by mu and sigma

Definition at line 209 of file Random.h.

int Random::getRandomNumberInt ( int  minRange,
int  maxRange 
)
inline

Gets a random integer in the range [minRange maxRange-1], using a uniform distribution

Parameters
intminRange: the minimum value in the range (inclusive)
intmaxRange: the maximum value in the range (not inclusive)
Returns
returns an integer in the range [minRange maxRange-1]

Definition at line 88 of file Random.h.

Float Random::getRandomNumberUniform ( Float  minRange = 0.0,
Float  maxRange = 1.0 
)
inline

Gets a random Float in the range [minRange maxRange], using a uniform distribution

Parameters
minRangethe minimum value in the range (inclusive)
maxRangethe maximum value in the range (inclusive)
Returns
returns a Float in the range [minRange maxRange]

Definition at line 198 of file Random.h.

int Random::getRandomNumberWeighted ( const Vector< int > &  values,
const VectorFloat weights 
)
inline

Gets a random integer from the Vector values. The probability of choosing a specific integer from the values Vector is given by the corresponding weight in the weights Vector. The size of the values Vector must match the size of the weights Vector. The weights do not need to sum to 1.

For example, if the input values are: [1 2 3] and weights are: [0.7 0.2 0.1], then the 1 value would be randomly returned 70% of the time, the 2 value returned 20% of the time and the 3 value returned 10% of the time.

Parameters
constVector< int > &values: a Vector containing the N possible values the function can return
constVector< Float > &weights: the corresponding weights for the values Vector (must be the same size as the values Vector)
Returns
returns a random integer from the values Vector, with a probability relative to the values weight

Definition at line 105 of file Random.h.

int Random::getRandomNumberWeighted ( Vector< IndexedDouble weightedValues)
inline

Gets a random integer from the input Vector. The probability of choosing a specific integer is given by the corresponding weight of that value. The weights do not need to sum to 1.

For example, if the input values are: [{1 0.7},{2 0.2}, {3 0.1}], then the 1 value would be randomly returned 70% of the time, the 2 value returned 20% of the time and the 3 value returned 10% of the time.

Parameters
Vector<IndexedDouble > weightedValues: a Vector of IndexedDouble values, the (int) indexs represent the value that will be returned while the (Float) values represent the weight of choosing that specific index
Returns
returns a random integer from the values Vector, with a probability relative to the values weight

Definition at line 129 of file Random.h.

int Random::getRandomNumberWeighted ( Vector< IndexedDouble > &  weightedValues,
VectorFloat x 
)
inline

This function is similar to the getRandomNumberWeighted(Vector< IndexedDouble > weightedValues), with the exception that the user needs to sort the weightedValues Vector and create the accumulated lookup table (x). This is useful if you need to call the same function multiple times on the same weightedValues, allowing you to only sort and build the loopup table once.

Gets a random integer from the input Vector. The probability of choosing a specific integer is given by the corresponding weight of that value. The weights do not need to sum to 1.

For example, if the input values are: [{1 0.7},{2 0.2}, {3 0.1}], then the 1 value would be randomly returned 70% of the time, the 2 value returned 20% of the time and the 3 value returned 10% of the time.

Parameters
weightedValuesa sorted Vector of IndexedDouble values, the (int) indexs represent the value that will be returned while the (Float) values represent the weight of choosing that specific index
xa Vector containing the accumulated lookup table
Returns
returns a random integer from the values Vector, with a probability relative to the values weight

Definition at line 173 of file Random.h.

Vector< unsigned int > Random::getRandomSubset ( const unsigned int  startRange,
const unsigned int  endRange,
const unsigned int  subsetSize 
)
inline

Gets an N-dimensional Vector of random unsigned ints drawn from the range controlled by the start and end range parameters.

Parameters
startRangeindicates the start of the range the random subset will selected from (e.g. 0)
endRangeindicates the end of the range the random subset will selected from (e.g. 100)
subsetSizecontrols the size of the Vector returned by the function (e.g. 50
Returns
returns a Vector of unsigned ints selected from the

Definition at line 268 of file Random.h.

VectorFloat Random::getRandomVectorGauss ( UINT  numDimensions,
Float  mu = 0.0,
Float  sigma = 1.0 
)
inline

Gets an N-dimensional Vector of random Floats drawn from the Gaussian distribution controlled by mu and sigma.

Parameters
numDimensionsthe size of the Vector you require
muthe mu parameter for the Gaussian distribution
sigmathe sigma parameter for the Gaussian distribution
Returns
returns a Vector of Floats drawn from the Gaussian distribution controlled by mu and sigma

Definition at line 252 of file Random.h.

VectorFloat Random::getRandomVectorUniform ( UINT  numDimensions,
Float  minRange = 0.0,
Float  maxRange = 1.0 
)
inline

Gets an N-dimensional Vector of random Floats drawn from the uniform distribution set by the minRange and maxRange.

Parameters
numDimensionsthe size of the Vector you require
minRangethe minimum value in the range (inclusive)
maxRangethe maximum value in the range (inclusive)
Returns
returns a Vector of Floats drawn from the uniform distribution set by the minRange and maxRange

Definition at line 236 of file Random.h.

void Random::setSeed ( unsigned long long  seed = 0)
inline

Sets the current seed used to compute the random distrubutions.

Parameters
seedsets the current seed, If no seed is supplied then the seed will be set using the current system time
Returns
returns void

Definition at line 68 of file Random.h.


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