cupy.random.RandomState#
- class cupy.random.RandomState(seed=None, method=None)[source]#
Portable container of a pseudo-random number generator.
An instance of this class holds the state of a random number generator. The state is available only on the device which has been current at the initialization of the instance.
Functions of
cupy.random
use global instances of this class. Different instances are used for different devices. The global state for the current device can be obtained by thecupy.random.get_random_state()
function.- Parameters:
seed (None or int) – Seed of the random number generator. See the
seed()
method for detail.method (int) –
Method of the random number generator. Following values are available:
cupy.cuda.curand.CURAND_RNG_PSEUDO_DEFAULT cupy.cuda.curand.CURAND_RNG_PSEUDO_XORWOW cupy.cuda.curand.CURAND_RNG_PSEUDO_MRG32K3A cupy.cuda.curand.CURAND_RNG_PSEUDO_MTGP32 cupy.cuda.curand.CURAND_RNG_PSEUDO_MT19937 cupy.cuda.curand.CURAND_RNG_PSEUDO_PHILOX4_32_10
Methods
- beta(a, b, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the beta distribution.
See also
cupy.random.beta()
for full documentation
- binomial(n, p, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from the binomial distribution.
See also
cupy.random.binomial()
for full documentation
- chisquare(df, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the chi-square distribution.
See also
cupy.random.chisquare()
for full documentation
- choice(a, size=None, replace=True, p=None)[source]#
Returns an array of random values from a given 1-D array.
See also
cupy.random.choice()
for full documentationnumpy.random.choice()
- dirichlet(alpha, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the dirichlet distribution.
See also
cupy.random.dirichlet()
for full documentation
- exponential(scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from a exponential distribution.
Warning
This function may synchronize the device.
See also
cupy.random.exponential()
for full documentation
- f(dfnum, dfden, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the f distribution.
See also
cupy.random.f()
for full documentation
- gamma(shape, scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from a gamma distribution.
See also
cupy.random.gamma()
for full documentation
- geometric(p, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from the geometric distribution.
See also
cupy.random.geometric()
for full documentation
- gumbel(loc=0.0, scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from a Gumbel distribution.
See also
cupy.random.gumbel()
for full documentation
- hypergeometric(ngood, nbad, nsample, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from the hypergeometric distribution.
See also
cupy.random.hypergeometric()
for full documentation
- laplace(loc=0.0, scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the laplace distribution.
See also
cupy.random.laplace()
for full documentation
- logistic(loc=0.0, scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the logistic distribution.
See also
cupy.random.logistic()
for full documentation
- lognormal(mean=0.0, sigma=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from a log normal distribution.
See also
cupy.random.lognormal()
for full documentation
- logseries(p, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from a log series distribution.
Warning
This function may synchronize the device.
See also
cupy.random.logseries()
for full documentation
- multivariate_normal(mean, cov, size=None, check_valid='ignore', tol=1e-08, method='cholesky', dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the multivariate normal distribution.
Warning
This function calls one or more cuSOLVER routine(s) which may yield invalid results if input conditions are not met. To detect these invalid results, you can set the linalg configuration to a value that is not ignore in
cupyx.errstate()
orcupyx.seterr()
.See also
cupy.random.multivariate_normal()
for full documentation
- negative_binomial(n, p, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from the negative binomial distribution.
Warning
This function may synchronize the device.
See also
cupy.random.negative_binomial()
for full documentation
- noncentral_chisquare(df, nonc, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the noncentral chi-square distribution.
Warning
This function may synchronize the device.
See also
cupy.random.noncentral_chisquare()
for full documentation
- noncentral_f(dfnum, dfden, nonc, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the noncentral F distribution.
Warning
This function may synchronize the device.
See also
cupy.random.noncentral_f()
for full documentation
- normal(loc=0.0, scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of normally distributed samples.
See also
cupy.random.normal()
for full documentation
- pareto(a, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the pareto II distribution.
See also
cupy.random.pareto()
for full documentation
- poisson(lam=1.0, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from the poisson distribution.
See also
cupy.random.poisson()
for full documentation
- power(a, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the power distribution.
Warning
This function may synchronize the device.
See also
cupy.random.power()
for full documentation
- rand(*size, **kwarg)[source]#
Returns uniform random values over the interval
[0, 1)
.See also
cupy.random.rand()
for full documentation
- randint(low, high=None, size=None, dtype=<class 'int'>)[source]#
Returns a scalar or an array of integer values over
[low, high)
.See also
cupy.random.randint()
for full documentation
- randn(*size, **kwarg)[source]#
Returns an array of standard normal random values.
See also
cupy.random.randn()
for full documentation
- random_sample(size=None, dtype=<class 'float'>)[source]#
Returns an array of random values over the interval
[0, 1)
.See also
cupy.random.random_sample()
for full documentation
- rayleigh(scale=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from a rayleigh distribution.
Warning
This function may synchronize the device.
See also
cupy.random.rayleigh()
for full documentation
- seed(seed=None)[source]#
Resets the state of the random number generator with a seed.
See also
cupy.random.seed()
for full documentation
- shuffle(a)[source]#
Returns a shuffled array.
See also
cupy.random.shuffle()
for full documentationnumpy.random.shuffle()
- standard_cauchy(size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the standard cauchy distribution.
See also
cupy.random.standard_cauchy()
for full documentation
- standard_exponential(size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the standard exp distribution.
See also
cupy.random.standard_exponential()
for full documentation
- standard_gamma(shape, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from a standard gamma distribution.
See also
cupy.random.standard_gamma()
for full documentation
- standard_normal(size=None, dtype=<class 'float'>)[source]#
Returns samples drawn from the standard normal distribution.
See also
cupy.random.standard_normal()
for full documentation
- standard_t(df, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the standard t distribution.
See also
cupy.random.standard_t()
for full documentation
- tomaxint(size=None)[source]#
Draws integers between 0 and max integer inclusive.
Return a sample of uniformly distributed random integers in the interval [0,
np.iinfo(np.int_).max
]. The np.int_ type translates to the C long integer type and its precision is platform dependent.- Parameters:
- Returns:
Drawn samples.
- Return type:
See also
numpy.random.RandomState.tomaxint()
- triangular(left, mode, right, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the triangular distribution.
Warning
This function may synchronize the device.
See also
cupy.random.triangular()
for full documentation
- uniform(low=0.0, high=1.0, size=None, dtype=<class 'float'>)[source]#
Returns an array of uniformly-distributed samples over an interval.
See also
cupy.random.uniform()
for full documentation
- vonmises(mu, kappa, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the von Mises distribution.
See also
cupy.random.vonmises()
for full documentation
- wald(mean, scale, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the Wald distribution.
See also
cupy.random.wald()
for full documentation
- weibull(a, size=None, dtype=<class 'float'>)[source]#
Returns an array of samples drawn from the weibull distribution.
Warning
This function may synchronize the device.
See also
cupy.random.weibull()
for full documentation
- zipf(a, size=None, dtype=<class 'int'>)[source]#
Returns an array of samples drawn from the Zipf distribution.
Warning
This function may synchronize the device.
See also
cupy.random.zipf()
for full documentation
- __eq__(value, /)#
Return self==value.
- __ne__(value, /)#
Return self!=value.
- __lt__(value, /)#
Return self<value.
- __le__(value, /)#
Return self<=value.
- __gt__(value, /)#
Return self>value.
- __ge__(value, /)#
Return self>=value.