.DESLib.RandomLib.Variates.Discrete.Discrete

Information

Discrete

Empirical discrete probability distribution.

Syntax

Discrete(g,p[:],v[:])

Description

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

Examples

 Discrete(g,{0.2,0.4,0.6,0.8,1},{1,2,3,4,5});

Interface

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;

Generated at 2024-05-18T18:16:21Z by OpenModelicaOpenModelica 1.22.4 using GenerateDoc.mos