Discrete | CPN Tools help |
Function for generating values from discrete uniform distributions | CPN ML |
discrete (a:int, b:int) : int
where a<=b
. Returns a drawing from a discrete uniform
distribution between a
and b
(a
and b
included).
Raises Discrete
exception, if a>b
.
Mean: | (a+b)/2 |
Variance: | ((b-a+1)^2-1)/12 |
Probability mass functions for discrete uniform distributions:
discrete(1,6)
Throwing a die has a discrete uniform distribution with parameters
a=1
and b=6
. The function discrete
will then return the number of eyes on the die.