Probabilities are ignored in numpy
<p>I'm trying to use the numpy library to sample a character from a distribution, but it seems to ignore the probabilities I give in input.
I have a probability array, which just to test I set to </p>

<pre><code>vec_p=[0,0,1,0,0] 
</code></pre>

<p>and a character array </p>

<pre><code>vec_c=[a,b,c,d,e]
</code></pre>

<p>If I do</p>

<pre><code>numpy.random.choice(vec_c,10,vec_p)
</code></pre>

<p>I would expect to get </p>

<pre><code>cccccccccc
</code></pre>

<p>since the other probabilities are all zero, but it just gives me random values ignoring the vec_p array. 
Am I doing something wrong?</p>

<p>Passing the parameters as keyword arguments gives the correct results:</p>

<pre><code>&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; vec_p = [0,0,1,0,0]
&gt;&gt;&gt; num = np.arange(5)
&gt;&gt;&gt; np.random.choice(num, size=10, p=vec_p)
array([2, 2, 2, 2, 2, 2, 2, 2, 2, 2])
</code></pre>

python arrays numpy