next up previous contents index
Next: Probability Mass Function Up: Random Variables Previous: Random Variables   Contents   Index

Probability Density Functions

Several random variables are provided in DEVS#. All random variable classes are defined in Util\RV.cs. RVofGeneralPDF class generates a random number of the uniform probability density function (PDF), the triangular PDF, the exponential PDF, and the normal PDF as follows.
    public class RVofGeneralPDF: Random
    {
        public RVofGeneralPDF() : base() { }
        public double Uniform(double min, double max);
        public double Triangular(double min, double max, double mode);
        public double Exponential(double mean);
        public double Normal(double mean, double sd);
    }
We took a look at the use of RVofGeneralPDF in the ping-pong example in Section 1.3.

If we want to make an instance of a specific PDF's random variable, we can use RV_Uniform, RV_Triangular, RV_Exponential, and RV_Normal which are derived classes from an abstract class, RVofPDF. The abstract function RN() of RVofPDF is overrided in each derived class as follows.

    public abstract class RVofPDF : Random
    {
        protected RVofPDF() : base() { }
        public abstract double RN();
    }
    public class RV_Uniform : RVofPDF
    {
        protected double min, max;
        public RV_Uniform(double _min, double _max): base(){...}
        public override double RN(){...} // return Uniform[min,max]
    }
    public class RV_Triangular : RVofPDF
    {
        protected double min, max, mode;
        public RV_Triangular(double _min, double _max, double _mode): base(){...}
        public override double RN(){...} // return Triangular(min,max,mode)
    }
    public class RV_Exponential : RVofPDF
    {
        protected double mean;
        public RV_Exponential(double _mean): base(){...}
        public override double RN(){...} // return Exponential(mean);
    }

    public class RV_Normal : RVofPDF
    {
        protected double mean, sd;
        public RV_Normal(double _mean, double sd): base(){...}
        public override double RN() {...}// return Normal(mean, sd);
    }
We will see the use of these PDFs in example in Section



MHHwang 2007-05-08