MKL-powered RandomState¶
- class mkl_random.MKLRandomState(seed=None, brng='MT19937')¶
Container for the Intel(R) MKL-powered (pseudo-)random number generators.
MKLRandomState exposes a number of methods for generating random numbers drawn from a variety of probability distributions. In addition to the distribution-specific arguments, each method takes a keyword argument size that defaults to
None. If size isNone, then a single value is generated and returned. If size is an integer, then a 1-D array filled with generated values is returned. If size is a tuple, then an array with that shape is filled and returned.Compatibility Notice While this class shares some similarities with the original RandomState, it has been rewritten to use MKL’s vector statistics functionality, that provides efficient implementation of the MT19937 and many other basic psuedo-random number generation algorithms as well as efficient sampling from other common statistical distributions. As a consequence this version is NOT seed-compatible with the original RandomState.
- Parameters:
- seed{None, int, array_like}, optional
Random seed initializing the pseudo-random number generator. Can be an integer, an array (or other sequence) of integers of any length, or
None(the default). If seed isNone, then RandomState will try to read data from/dev/urandom(or the Windows analogue) if available or seed from the clock otherwise.- brngstr, optional
Name of the basic random number generation algorithm, or a non-deterministic hardware-based generator, provided by Intel MKL. One of ‘MT19937’, ‘SFMT19937’, ‘MT2203’, ‘R250’, ‘WH’, ‘MCG31’, ‘MCG59’, ‘MRG32K3A’, ‘PHILOX4X32X10’, ‘NONDETERM’, ‘ARS5’. The default is ‘MT19937’, the Mersenne Twister generator.
Notes
The Python stdlib module “random” also contains a Mersenne Twister pseudo-random number generator with a number of methods that are similar to the ones available in MKLRandomState. MKLRandomState, besides being NumPy-aware, has the advantage that it provides a much larger number of probability distributions to choose from.
References
Note
mkl_random.RandomState is a deprecated alias of
mkl_random.MKLRandomState, kept for backward compatibility with
legacy code. A NumPy-compatible drop-in replacement for
numpy.random.RandomState is available in
mkl_random.interfaces.numpy_random.
Seeding and state¶
Simple random data¶
Random values in a given shape. |
|
Return a sample (or samples) from the "standard normal" distribution. |
|
Return random integers from low (inclusive) to high (exclusive). |
|
Random integers of type np.int between low and high, inclusive. |
|
Return random floats in the half-open interval [0.0, 1.0). |
|
Return a sample of uniformly distributed random integers in the interval [0, |
|
Generates a random sample from a given 1-D array |
|
Return random bytes. |
Permutations¶
Modify a sequence in-place by shuffling its contents. |
|
Randomly permute a sequence, or return a permuted range. |
Distributions¶
Draw samples from a Beta distribution. |
|
Draw samples from a binomial distribution. |
|
Draw samples from a chi-square distribution. |
|
Draw samples from the Dirichlet distribution. |
|
Draw samples from an exponential distribution. |
|
Draw samples from an F distribution. |
|
Draw samples from a Gamma distribution. |
|
Draw samples from the geometric distribution. |
|
Draw samples from a Gumbel distribution. |
|
Draw samples from a Hypergeometric distribution. |
|
Draw samples from the Laplace or double exponential distribution with specified location (or mean) and scale (decay). |
|
Draw samples from a logistic distribution. |
|
Draw samples from a log-normal distribution. |
|
Draw samples from a logarithmic series distribution. |
|
Draw samples from a multinomial distribution. |
|
Draw random samples from a multivariate normal distribution. |
|
Draw samples from a negative binomial distribution. |
|
Draw samples from a noncentral chi-square distribution. |
|
Draw samples from the noncentral F distribution. |
|
Draw random samples from a normal (Gaussian) distribution. |
|
Draw samples from a Pareto II or Lomax distribution with specified shape. |
|
Draw samples from a Poisson distribution. |
|
Draws samples in [0, 1] from a power distribution with positive exponent a - 1. |
|
Draw samples from a Rayleigh distribution. |
|
Draw samples from a standard Cauchy distribution with mode = 0. |
|
Draw samples from the standard exponential distribution. |
|
Draw samples from a standard Gamma distribution. |
|
Draw samples from a standard Normal distribution (mean=0, stdev=1). |
|
Draw samples from a standard Student's t distribution with df degrees of freedom. |
|
Draw samples from the triangular distribution. |
|
Draw samples from a uniform distribution. |
|
Draw samples from a von Mises distribution. |
|
Draw samples from a Wald, or inverse Gaussian, distribution. |
|
Draw samples from a Weibull distribution. |
|
Draw samples from a Zipf distribution. |
MKL-specific methods¶
Initializes the current state generator using leap-frog method, if supported for the basic random pseudo-random number generation algorithm. |
|
Initializes the current state generator using skip-ahead method, if supported for the basic random pseudo-random number generation algorithm. |
|
Return random integers from low (inclusive) to high (exclusive). |
|
Draw random samples from a multivariate normal distribution. |