Empirical discrete probability distribution.
Discrete(g,p[:],v[:])
This function generates random variates following the Empirical Discrete distribution function described by the parameters p and v.
Parameter p represents the list of cummulative probabilities related with the values in v.
Length of p and v must be the same.
The following figure graphically shows the empirical discrete distribution.
Discrete(g,{0.2,0.4,0.6,0.8,1},{1,2,3,4,5});
function Discrete input CMRG.RngStream g "Random number generator"; input Real p[:] "Cummulative probabilities"; input Real v[:] "Values related with the probabilities"; output Real value "Generated random variate"; output CMRG.RngStream gout "Updated random number generator"; end Discrete;