[SciPy-User] Picking a random element of an array with conditions

R. Padraic Springuel R.Springuel@umit.maine....
Fri Jun 11 13:12:27 CDT 2010

I'd like to pick the random element of an array from those elements 
which meet a certain condition.  I.e. pick an element of a for which a 
== value is True.

Without the condition, I'd phrase the command like this:

Is there some similar thing that I can do to pick with the condition in 
an efficient manner?  So far all I've come up with involves looping over 
the array to construct an array of indecies so that I can write:


R. Padraic Springuel
Research Assistant
Department of Physics and Astronomy
University of Maine
Bennett 309
Office Hours: By Appointment Only

More information about the SciPy-User mailing list