title: Generating random numbers from custom continuous probability density function
body: <p>as the title states I am trying to generate random numbers from a custom continuous probability density function, which is:</p>
  <pre><code>0.001257 *x^4 * e^(-0.285714 *x)
  </code></pre>
  <p>to do so, I use (on python 3)  <code>scipy.stats.rv_continuous</code> and then <code>rvs()</code> to generate them</p>
  <pre><code>from decimal import Decimal
  from scipy import stats
  import numpy as np
  
  class my_distribution(stats.rv_continuous):
      def _pdf(self, x):
          return (Decimal(0.001257) *Decimal(x)**(4)*Decimal(np.exp(-0.285714 *x)))
  
  distribution = my_distribution()
  distribution.rvs()
  </code></pre>
  <p>note that I used Decimal to get rid of an <code>OverflowError: (34, 'Result too large')</code>.</p>
  <p>Still, I get an error <code>RuntimeError: Failed to converge after 100 iterations</code>.</p>
  <p>What's going on there? What's the proper way to achieve what I need to do?</p>