|
| 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) |
|
Definition at line 40 of file Random.h.
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
-
seed | sets 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.
Default destructor.
Definition at line 59 of file Random.h.
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
-
mu | the mu parameter for the Gaussian distribution |
sigma | the 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
-
int | minRange: the minimum value in the range (inclusive) |
int | maxRange: 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
-
minRange | the minimum value in the range (inclusive) |
maxRange | the 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
-
- 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.
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.
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
-
weightedValues | a 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 |
x | a 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
-
startRange | indicates the start of the range the random subset will selected from (e.g. 0) |
endRange | indicates the end of the range the random subset will selected from (e.g. 100) |
subsetSize | controls 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
-
numDimensions | the size of the Vector you require |
mu | the mu parameter for the Gaussian distribution |
sigma | the 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
-
numDimensions | the size of the Vector you require |
minRange | the minimum value in the range (inclusive) |
maxRange | the 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
-
seed | sets 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: