Command: rdevdict::*_clipped

Generate random numbers from an underlying distribution
but restricted to a certain interval.

For continuous distributions

low < random < high

will hold true i.e. numbers are restricted to the open interval (low high).
If the distribution itself is restricted to e.g. positiv numbers setting
low < 0 will still only return positive numbers. Clipping only excludes numbers
outside (low high).

For discrete distribtions numbers are limited to {low low+1 ... high} i.e.
in this case min and max are included.

Numbers are clipped by re-drawing any number outside (low high) until
a number in (log high) is drawn. The actual distribution of random
numbers drawn will be a distorted version of the underlying


/low lower bound (default: -inf)
/high upper bound (default: +inf)

Hans Ekkehard Plesser

- Clipped generators can be very inefficient if there is little probability
mass in (low high).
- For continuous distributions the probability of actually drawing
min or max is approximately 2^-62 ~ 2e-19 i.e. negligible. Therefore
one can only clip to open intervals.
- There are also *_clipped_to_boundary versions of the generators. These
return the respective boundary value if a value outside the interval is
drawn. These versions are mainly provided to allow reproduction of
publications that used this strategy.