module Sampler:a compiled finite discrete probability distribution that supports constant time sampling`sig`

..`end`

`type ``'a`

t

a compiled finite discrete probability distribution that supports constant
time sampling

`val create : ``('a * float) list -> 'a t`

`create dist`

compiles a discrete probability distribution into a form
supporting constant-time sampling. The running time is O(N) where N =
`List.length dist`

. `dist`

may be either a probability distribution
(all floats are non-negative and sum to 1) or, more generally,
a histogram in which frequencies are interpreted as probabilities.`val sample : ``?state:Core.Std.Random.State.t -> 'a t -> 'a`

randomly sample the distribution in constant time