title: Why does Scipy rv_discrete always return 1
body: <p>I'm trying to form the distribution of a random variable. Where the probability that a reaction fires is: </p>
  
  <p>Prob(Rj fires) = aj/a0</p>
  
  <p>aj = a propensity function, that describes the probability an individual reaction fires in a given time period.</p>
  
  <p>a0 = the sum of all the propensity functions for all the reactions in the system. </p>
  
  <p>At the moment I have a function that returns an array of propensity functions for each reaction in the systems, which outputs: </p>
  
  <pre><code>[32.  0.  0.]
  </code></pre>
  
  <p>I have then used a0 = sum(propensity) to calculate a0. which is followed by a second function:  </p>
  
  <pre class="lang-py prettyprint-override"><code>def prob_rxn_fires(propensity, a0):
      prob = propensity/a0   
      return prob
  </code></pre>
  
  <p>To calculate aj/a0, the output of this function is assigned to the variable: rxn_probability. 
  There are three reactions in my system and I'm now trying to use scipy.stats.rv_discrete to sample from the distribution. </p>
  
  <p>I have the number of reactions in the system stored in the array: </p>
  
  <pre><code>num_rxn = np.arange(1, rxn_probability.size + 1).reshape(rxn_probability.shape)
  </code></pre>
  
  <p>which is shaped and sized so it always matches with the rxn_probability array. </p>
  
  <p>My code at the moment is: </p>
  
  <pre><code>j = stats.rv_discrete(name="Reaction index", values=(num_rxn, rxn_probability)).rvs()
  </code></pre>
  
  <p>but the output is always 1 and I'm not sure if thats right and if not why its not right ? </p>
  
  <p>Cheers </p>