[Numpy-discussion] A bug in numpy.random.shuffle?

Bradley M. Froehle brad.froehle at gmail.com
Thu Sep 5 15:34:46 EDT 2013


I put this test case through `git bisect run` and here's what came
back.  I haven't confirmed this manually yet, but the blamed commit
does seem reasonable:

b26c675e2a91e1042f8f8d634763942c87fbbb6e is the first bad commit
commit b26c675e2a91e1042f8f8d634763942c87fbbb6e
Author: Nathaniel J. Smith <njs at pobox.com>
Date:   Thu Jul 12 13:20:20 2012 +0100

    [FIX] Make np.random.shuffle less brain-dead

    The logic in np.random.shuffle was... not very sensible. Fixes trac
    ticket #2074.

    This patch also exposes a completely unrelated issue in
    numpy.testing. Filed as Github issue #347 and marked as knownfail for
    now.

:040000 040000 6f3cf0c85a64664db6a71bd59909903f18b51639
0b6c8571dd3c9de8f023389f6bd963e42b12cc26 M numpy
bisect run success

On Thu, Sep 5, 2013 at 11:58 AM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
>
>
>
> On Thu, Sep 5, 2013 at 12:50 PM, Fernando Perez <fperez.net at gmail.com>
> wrote:
>>
>> On Thu, Sep 5, 2013 at 11:43 AM, Charles R Harris
>> <charlesr.harris at gmail.com> wrote:
>>
>>
>> > Oh, nice one ;) Should be fixable if you want to submit a patch.
>>
>> Strategy? One option is to do, for structured arrays, a shuffle of the
>> indices and then an in-place
>>
>> arr = arr[shuffled_indices]
>>
>> But there may be a cleaner/faster way to do it.
>>
>> I'm happy to submit a patch, but I'm not familiar enough with the
>> internals to know what the best approach should be.
>>
>
> Better open an issue. It looks like a bug in the indexing code.
>
> Chuck
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list