visigoth.truncated_sample

visigoth.truncated_sample(rv, size=1, min=- inf, max=inf, **kwargs)[source]

Iteratively sample from a random variate rejecting values outside limits.

Parameters
rvrandom variate object

Must have a .rvs method for generating random samples.

sizeint or tuple, optional

Output shape.

min, maxfloat

Exclusive limits on the distribution values.

kwargskey, value mappings

Other keyword arguments are passed to rv.rvs().

Returns
outarray

Samples from rv that are within (min, max).