functionDiscrete
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.
Examples
Discrete(g,{0.2,0.4,0.6,0.8,1},{1,2,3,4,5});
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| CMRG.RngStream | g | Random number generator | |
| Real[:] | p | Cummulative probabilities | |
| Real[:] | v | Values related with the probabilities |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | value | Generated random variate | |
| CMRG.RngStream | gout | Updated random number generator |