Construct a CDF sampler from given weights.
The weights do not have to be normalized. If all weights are zero, or the array is empty, the sampler will return the (non-existent) index 0 with probability 1.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in) | :: | w(:) | |||
real(kind=dp), | intent(in) | :: | total |