[Numpy-discussion] random permutation
Ted Horst
ted.horst at earthlink.net
Thu Jan 25 21:30:42 CST 2007
BTW, This test doesn't work on python 2.3 because sorted does not
exist there.
Ted
On Jan 13, 2007, at 15:15, Stefan van der Walt wrote:
> On Sat, Jan 13, 2007 at 10:01:59AM -0800, Keith Goodman wrote:
>> On 1/11/07, Robert Kern <robert.kern at gmail.com> wrote:
>>> Keith Goodman wrote:
>>>> Why is the first element of the permutation always the same? Am I
>>>> using random.permutation in the right way?
>>>
>>>>>> M.__version__
>>>> '1.0rc1'
>>>
>>> This has been fixed in more recent versions.
>>>
>>> http://projects.scipy.org/scipy/numpy/ticket/374
>>
>> I don't see any unit tests for numpy.random. I guess randomness is
>> hard to test.
>
> Every time we fix a bug, we add a corresponding test to make sure
> that it
> doesn't pop up again. In this case, take a look in
> numpy/core/tests/test_regression.py:
>
> def check_random_shuffle(self, level=rlevel):
> """Ticket #374"""
> a = N.arange(5).reshape((5,1))
> b = a.copy()
> N.random.shuffle(b)
> assert_equal(sorted(b),a)
>
> Cheers
> Stéfan
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
More information about the Numpy-discussion
mailing list