title: how to get the index of numpy.random.choice? - python
body: <p>Is it possible to modify the numpy.random.choice function in order to make it return the index of the chosen element? 
  Basically, I want to create a list and select elements randomly without replacement</p>
  
  <pre><code>import numpy as np
  &gt;&gt;&gt; a = [1,4,1,3,3,2,1,4]
  &gt;&gt;&gt; np.random.choice(a)
  &gt;&gt;&gt; 4
  &gt;&gt;&gt; a
  &gt;&gt;&gt; [1,4,1,3,3,2,1,4]
  </code></pre>
  
  <p><code>a.remove(np.random.choice(a))</code> will remove the first element of the list with that value it encounters (<code>a[1]</code> in the example above), which may not be the chosen element (eg, <code>a[7]</code>).</p>