chrono::ChDiscreteDistribution Class Reference

Description

Class that can be used to generate sample numbers according to a discrete probability distribution.

Probability distribution is defined with discrete values, each with a percentual of probability.

#include <ChDistribution.h>

Inheritance diagram for chrono::ChDiscreteDistribution:
Collaboration diagram for chrono::ChDiscreteDistribution:

Public Member Functions

 ChDiscreteDistribution (ChMatrix<> &mx, ChMatrix<> &my)
 Create an object that can be used to generate sample numbers according to a discrete probability distribution. More...
 
virtual double GetRandom ()
 Compute a random value, according to the discrete probabilty values entered when you created this object.
 
ChMatrixGetProbabilityXpoints ()
 
ChMatrixGetProbabilityYpoints ()
 
ChMatrixGetProbabilityCDFcumulativeY ()
 
- Public Member Functions inherited from chrono::ChDistribution
virtual ~ChDistribution ()
 Default destructor for distribution object.
 

Constructor & Destructor Documentation

chrono::ChDiscreteDistribution::ChDiscreteDistribution ( ChMatrix<> &  mx,
ChMatrix<> &  my 
)

Create an object that can be used to generate sample numbers according to a discrete probability distribution.

Probability distribution is defined with N discrete values, each with a percentual of probability. The sum of the N probability values must be unit, i.e normalized (but if not, a normalization will be enforced) For example, to get '12.3' for 30% of the times you call GetRandom(), and '150' for the remaining 70% of the times, create ChDiscreteDistribution with mx = [12.3; 150] and my = [0.3; 0.7]