Random Sampling (cupy.random
)¶
CuPy’s random number generation routines are based on cuRAND.
They cover a small fraction of numpy.random
.
The big difference of cupy.random
from numpy.random
is that cupy.random
supports dtype
option for most functions.
This option enables us to generate float32 values directly without any space overhead.
Sample random data¶
cupy.random.choice |
Returns an array of random values from a given 1-D array. |
cupy.random.rand |
Returns an array of uniform random values over the interval [0, 1) . |
cupy.random.randn |
Returns an array of standard normal random values. |
cupy.random.randint |
Returns a scalar or an array of integer values over [low, high) . |
cupy.random.random_integers |
Return a scalar or an array of integer values over [low, high] |
cupy.random.random_sample |
Returns an array of random values over the interval [0, 1) . |
cupy.random.random |
Returns an array of random values over the interval [0, 1) . |
cupy.random.ranf |
Returns an array of random values over the interval [0, 1) . |
cupy.random.sample |
Returns an array of random values over the interval [0, 1) . |
cupy.random.bytes |
Returns random bytes. |
Distributions¶
cupy.random.gumbel |
Returns an array of samples drawn from a Gumbel distribution. |
cupy.random.lognormal |
Returns an array of samples drawn from a log normal distribution. |
cupy.random.normal |
Returns an array of normally distributed samples. |
cupy.random.standard_normal |
Returns an array of samples drawn from the standard normal distribution. |
cupy.random.uniform |
Returns an array of uniformly-distributed samples over an interval. |
Random number generator¶
cupy.random.seed |
Resets the state of the random number generator with a seed. |
cupy.random.get_random_state |
Gets the state of the random number generator for the current device. |
cupy.random.set_random_state |
Sets the state of the random number generator for the current device. |
cupy.random.RandomState |
Portable container of a pseudo-random number generator. |
Permutations¶
cupy.random.shuffle |
Shuffles an array. |