iLand
|
numbers with a user defined probaility density function. More...
#include <random.h>
Public Member Functions | |
RandomCustomPDF () | |
RandomCustomPDF (const QString &densityFunction) | |
~RandomCustomPDF () | |
void | setup (const QString &funcExpr, const double lowerBound=0., const double upperBound=1., const bool isSumFunc=false, const int stepCount=100) |
setup of the properites of the RandomCustomPDF. More... | |
const QString & | densityFunction () const |
double | get () |
get a random number More... | |
double | getProbOfRange (const double lowerBound, const double upperBound) |
get probability of random numbers between given bounds. More... | |
numbers with a user defined probaility density function.
Call setup() or use the constructor to provide a function-expression with one variable (e.g. 'x^2'). Call get() to retrieve a random number that follows the given probabilty density function. The provided function is not bound to a specific value range, but should produce values below 40.
RandomCustomPDF::RandomCustomPDF | ( | ) |
|
inline |
RandomCustomPDF::~RandomCustomPDF | ( | ) |
|
inline |
double RandomCustomPDF::get | ( | ) |
get a random number
double RandomCustomPDF::getProbOfRange | ( | const double | lowerBound, |
const double | upperBound | ||
) |
get probability of random numbers between given bounds.
void RandomCustomPDF::setup | ( | const QString & | funcExpr, |
const double | lowerBound = 0. , |
||
const double | upperBound = 1. , |
||
const bool | isSumFunc = false , |
||
const int | stepCount = 100 |
||
) |
setup of the properites of the RandomCustomPDF.
funcExpr
the probability density function is given as a string for an Expression. The variable (e.g. 'x') lowerBound
lowest possible value of the random numbers (default=0) upperBound
highest possible value of the random numbers (default=1) isSumFunc
if true, the function given in 'funcExpr' is a cumulative probabilty density function (default=false) stepCount
internal degree of 'slots' - the more slots, the more accurate (default=100)