cupy.random
Differences between cupy.random
and numpy.random
:
- CuPy provides Legacy Random Generation API (see also: NumPy 1.16 Reference). The new random generator API (
numpy.random.Generator
class) introduced in NumPy 1.17 has not been implemented yet. - Most functions under
cupy.random
support thedtype
option, which do not exist in the corresponding NumPy APIs. This option enables generation of float32 values directly without any space overhead. - CuPy does not guarantee that the same number generator is used across major versions. This means that numbers generated by
cupy.random
by new major version may not be the same as the previous one, even if the same seed and distribution are used.
cupy.random.rand cupy.random.randn cupy.random.randint cupy.random.random_integers cupy.random.random_sample cupy.random.random cupy.random.ranf cupy.random.sample cupy.random.choice cupy.random.bytes
cupy.random.shuffle cupy.random.permutation
cupy.random.beta cupy.random.binomial cupy.random.chisquare cupy.random.dirichlet cupy.random.exponential cupy.random.f cupy.random.gamma cupy.random.geometric cupy.random.gumbel cupy.random.hypergeometric cupy.random.laplace cupy.random.logistic cupy.random.lognormal cupy.random.logseries cupy.random.multinomial cupy.random.multivariate_normal cupy.random.negative_binomial cupy.random.noncentral_chisquare cupy.random.noncentral_f cupy.random.normal cupy.random.pareto cupy.random.poisson cupy.random.power cupy.random.rayleigh cupy.random.standard_cauchy cupy.random.standard_exponential cupy.random.standard_gamma cupy.random.standard_normal cupy.random.standard_t cupy.random.triangular cupy.random.uniform cupy.random.vonmises cupy.random.wald cupy.random.weibull cupy.random.zipf
cupy.random.RandomState cupy.random.seed cupy.random.get_random_state cupy.random.set_random_state
Note
CuPy does not provide cupy.random.get_state
nor cupy.random.set_state
at this time. Use cupy.random.get_random_state
and cupy.random.set_random_state
instead. Note that these functions use cupy.random.RandomState
instance to represent the internal state, which cannot be serialized.