iLand
Public Member Functions | List of all members
RandomCustomPDF Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RandomCustomPDF() [1/2]

RandomCustomPDF::RandomCustomPDF ( )

◆ RandomCustomPDF() [2/2]

RandomCustomPDF::RandomCustomPDF ( const QString &  densityFunction)
inline

◆ ~RandomCustomPDF()

RandomCustomPDF::~RandomCustomPDF ( )

Member Function Documentation

◆ densityFunction()

const QString & RandomCustomPDF::densityFunction ( ) const
inline

◆ get()

double RandomCustomPDF::get ( )

get a random number

◆ getProbOfRange()

double RandomCustomPDF::getProbOfRange ( const double  lowerBound,
const double  upperBound 
)

get probability of random numbers between given bounds.

◆ setup()

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)


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