summaryrefslogtreecommitdiff
path: root/numpy/random
diff options
context:
space:
mode:
authorJoseph Fox-Rabinovitz <joseph.r.fox-rabinovitz@nasa.gov>2016-02-18 14:12:17 -0500
committerJoseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com>2016-02-22 21:44:54 -0500
commitc5e01fa725e5e7c1993b7eec401fa31be8580420 (patch)
tree2fefc699e8030078ffb7bc2d43a8442d242e04e2 /numpy/random
parente5c1ac175722bc58e74aac4e6d9138adf9260ec6 (diff)
downloadpython-numpy-c5e01fa725e5e7c1993b7eec401fa31be8580420.tar.gz
python-numpy-c5e01fa725e5e7c1993b7eec401fa31be8580420.tar.bz2
python-numpy-c5e01fa725e5e7c1993b7eec401fa31be8580420.zip
TST: Fixed shuffle axis in tests.
Since shuffle only works along the first dimension, it must be done before reshape to get reasonable looking data. Did not affect the current tests. I noticed while working on some scipy code. Also, made a couple of doc changes to np.random.shuffle.
Diffstat (limited to 'numpy/random')
-rw-r--r--numpy/random/mtrand/mtrand.pyx7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index b05d86747..1c07ae2cd 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -5003,6 +5003,10 @@ cdef class RandomState:
Modify a sequence in-place by shuffling its contents.
+ 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 : array_like
@@ -5019,8 +5023,7 @@ cdef class RandomState:
>>> arr
[1 7 5 2 9 4 3 6 0 8]
- This function only shuffles the array along the first index of a
- multi-dimensional array:
+ Multi-dimensional arrays are only shuffled along the first axis:
>>> arr = np.arange(9).reshape((3, 3))
>>> np.random.shuffle(arr)