diff options
author | Joseph Fox-Rabinovitz <joseph.r.fox-rabinovitz@nasa.gov> | 2016-02-18 14:12:17 -0500 |
---|---|---|
committer | Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> | 2016-02-22 21:44:54 -0500 |
commit | c5e01fa725e5e7c1993b7eec401fa31be8580420 (patch) | |
tree | 2fefc699e8030078ffb7bc2d43a8442d242e04e2 /numpy/random | |
parent | e5c1ac175722bc58e74aac4e6d9138adf9260ec6 (diff) | |
download | python-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.pyx | 7 |
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) |