cupy.random.choice¶
-
cupy.random.
choice
(a, size=None, replace=True, p=None)[source]¶ Returns an array of random values from a given 1-D array.
Each element of the returned array is independently sampled from
a
according top
or uniformly.Note
Currently
p
is not supported whenreplace=False
.Parameters: - a (1-D array-like or int) – If an array-like,
a random sample is generated from its elements.
If an int, the random sample is generated as if
a
wascupy.arange(n)
- size (int or tuple of ints) – The shape of the array.
- replace (boolean) – Whether the sample is with or without replacement.
- p (1-D array-like) – The probabilities associated with each entry in
a
. If not given the sample assumes a uniform distribution over all entries ina
.
Returns: - An array of
a
values distributed according to p
or uniformly.
Return type: See also
- a (1-D array-like or int) – If an array-like,
a random sample is generated from its elements.
If an int, the random sample is generated as if