bundles / numpy 2.4.4 / numpy / random / RandomState / shuffle
cython_function_or_method
numpy.random:RandomState.shuffle
Signature
def shuffle ( x ) Summary
Modify a sequence in-place by shuffling its contents.
Extended Summary
This function only shuffles the array along the first axis of a multi-dimensional array. The order of sub-arrays is changed but their contents remains the same.
Parameters
x: ndarray or MutableSequenceThe array, list or mutable sequence to be shuffled.
Returns
: None
Examples
arr = np.arange(10) np.random.shuffle(arr)✓
arr
✗arr = np.arange(9).reshape((3, 3)) np.random.shuffle(arr)✓
arr
✗See also
- random.Generator.shuffle
which should be used for new code.
Aliases
-
numpy.random.shuffle -
numpy.random.RandomState.shuffle