[SciPy-user] choose at random all elements in a array...
David Cournapeau
david at ar.media.kyoto-u.ac.jp
Sat Aug 4 06:05:17 EDT 2007
fred wrote:
> Hi,
>
> Say I have an array with 250 000 values.
>
> I want to choose at random _all_ the elements of this array,
> _once and only once_.
>
> How can I do this ?
>
> TIA.
>
> Cheers,
>
>
You can simply use a random permutation:
import numpy
a = numpy.array([1, 2, 3, 4, 5, 6])
numpy.random.permutation(a)
David
More information about the SciPy-User
mailing list