Random Number Generators (scipy.stats.sampling)#

This module contains a collection of random number generators to sample from univariate continuous and discrete distributions. It uses the implementation of a C library called “UNU.RAN”. The only exception is RatioUniforms, which is a pure Python implementation of the Ratio-of-Uniforms method.

Generators Wrapped#

For continuous distributions#

NumericalInverseHermite(dist, *[, domain, ...])

Hermite interpolation based INVersion of CDF (HINV).

NumericalInversePolynomial(dist, *[, mode, ...])

Polynomial interpolation based INVersion of CDF (PINV).

TransformedDensityRejection(dist, *[, mode, ...])

Transformed Density Rejection (TDR) Method.

SimpleRatioUniforms(dist, *[, mode, ...])

Simple Ratio-of-Uniforms (SROU) Method.

RatioUniforms(pdf, *, umax, vmin, vmax[, c, ...])

Generate random samples from a probability density function using the ratio-of-uniforms method.

For discrete distributions#

DiscreteAliasUrn(dist, *[, domain, ...])

Discrete Alias-Urn Method.

DiscreteGuideTable(dist, *[, domain, ...])

Discrete Guide Table method.

Warnings / Errors used in scipy.stats.sampling#


Raised when an error occurs in the UNU.RAN library.

Generators for pre-defined distributions#

To easily apply the above methods for some of the continuous distributions in scipy.stats, the following functionality can be used:

FastGeneratorInversion(dist, *[, domain, ...])

Fast sampling by numerical inversion of the CDF for a large class of continuous distributions in scipy.stats.