[Numpy-discussion] numpy.random.permutation bug?

Keith Goodman kwgoodman at gmail.com
Thu Jan 18 12:59:18 EST 2007


On 1/18/07, Keith Goodman <kwgoodman at gmail.com> wrote:
> On 1/18/07, Robert Kern <robert.kern at gmail.com> wrote:
> > Yes. 1.2 is not an integer. In Emanuele's example, a.sum() was an integer,
> > though not an int.
>
> Sorry, but I'm still confused. Does that mean that this is the
> expected behaviour?
>
> >> numpy.random.permutation(1)
> array([0])
>
> whereas
>
> >> numpy.random.permutation(1.2)
>
> should raise an error?

Crap. I should have read the doc string:

Type:           builtin_function_or_method
Base Class:     <type 'builtin_function_or_method'>
String Form:    <built-in method permutation of mtrand.RandomState
object at 0xb77abbb4>
Namespace:      Interactive
Docstring:
    Given an integer, return a shuffled sequence of integers >= 0 and
    < x; given a sequence, return a shuffled array copy.

    permutation(x)



More information about the NumPy-Discussion mailing list