I'm trying to generate random numbers from a given scipy stats random distribution, in my case a negative binomial distribution.
The documentation isn't entirely clear to me. Unfortunately, the documentation is a bit sparse: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.nbinom.html
This should be really simple.
The relevant method is rvs which stands for random variates.
You can generate a single random number drawn from a negative binomial distribution like this:
import scipy.stats
scipy.stats.nbinom.rvs(1,0.5) # returns 2 (or other random integer between 0 and +inf)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With