RandomState.set_state()

RandomState.set_state(state) Set the internal state of the generator from a tuple. For use if one has reason to manually (re-)set the internal state of the ?Mersenne Twister?[R190] pseudo-random number generating algorithm. Parameters: state : tuple(str, ndarray of 624 uints, int, int, float) The state tuple has the following items: the string ?MT19937?, specifying the Mersenne Twister algorithm. a 1-D array of 624 unsigned integers keys. an integer pos. an integer has_gauss. a float cach

RandomState.rayleigh()

RandomState.rayleigh(scale=1.0, size=None) Draw samples from a Rayleigh distribution. The and Weibull distributions are generalizations of the Rayleigh. Parameters: scale : scalar Scale, also equals the mode. Should be >= 0. size : int or tuple of ints, optional Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned. Notes The probability density function for the Rayleigh distribution is

RandomState.random_sample()

RandomState.random_sample(size=None) Return random floats in the half-open interval [0.0, 1.0). Results are from the ?continuous uniform? distribution over the stated interval. To sample multiply the output of random_sample by (b-a) and add a: (b - a) * random_sample() + a Parameters: size : int or tuple of ints, optional Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned. Returns: out : fl

RandomState.randint()

RandomState.randint(low, high=None, size=None, dtype='l') Return random integers from low (inclusive) to high (exclusive). Return random integers from the ?discrete uniform? distribution of the specified dtype in the ?half-open? interval [low, high). If high is None (the default), then results are from [0, low). Parameters: low : int Lowest (signed) integer to be drawn from the distribution (unless high=None, in which case this parameter is the highest such integer). high : int, optional

RandomState.random_integers()

RandomState.random_integers(low, high=None, size=None) Random integers of type np.int between low and high, inclusive. Return random integers of type np.int from the ?discrete uniform? distribution in the closed interval [low, high]. If high is None (the default), then results are from [1, low]. The np.int type translates to the C long type used by Python 2 for ?short? integers and its precision is platform dependent. This function has been deprecated. Use randint instead. Deprecated since

RandomState.randn()

RandomState.randn(d0, d1, ..., dn) Return a sample (or samples) from the ?standard normal? distribution. If positive, int_like or int-convertible arguments are provided, randn generates an array of shape (d0, d1, ..., dn), filled with random floats sampled from a univariate ?normal? (Gaussian) distribution of mean 0 and variance 1 (if any of the are floats, they are first converted to integers by truncation). A single float randomly sampled from the distribution is returned if no argument

RandomState.power()

RandomState.power(a, size=None) Draws samples in [0, 1] from a power distribution with positive exponent a - 1. Also known as the power function distribution. Parameters: a : float parameter, > 0 size : int or tuple of ints, optional Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned. Returns: samples : ndarray or scalar The returned samples lie in [0, 1]. Raises: ValueError If a &l

RandomState.rand()

RandomState.rand(d0, d1, ..., dn) Random values in a given shape. Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1). Parameters: d0, d1, ..., dn : int, optional The dimensions of the returned array, should all be positive. If no argument is given a single Python float is returned. Returns: out : ndarray, shape (d0, d1, ..., dn) Random values. See also random Notes This is a convenience function. If you want an interface

RandomState.poisson()

RandomState.poisson(lam=1.0, size=None) Draw samples from a Poisson distribution. The Poisson distribution is the limit of the binomial distribution for large N. Parameters: lam : float or sequence of float Expectation of interval, should be >= 0. A sequence of expectation intervals must be broadcastable over the requested size. size : int or tuple of ints, optional Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case

RandomState.permutation()

RandomState.permutation(x) Randomly permute a sequence, or return a permuted range. If x is a multi-dimensional array, it is only shuffled along its first index. Parameters: x : int or array_like If x is an integer, randomly permute np.arange(x). If x is an array, make a copy and shuffle the elements randomly. Returns: out : ndarray Permuted sequence or array range. Examples >>> np.random.permutation(10) array([1, 7, 4, 3, 0, 9, 2, 5, 8, 6]) >>> np.random.permutat