choice(key, a, shape=(), replace=True, p=None)¶
Generates a random sample from a given 1-D array.
ndarray) – a PRNGKey used as the random key.
Any) – 1D array or int. If an ndarray, a random sample is generated from its elements. If an int, the random sample is generated as if a were arange(a).
bool) – boolean. Whether the sample is with or without replacement. default is True.
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 in a.
- Return type
An array of shape shape containing samples from a.