I’ve been using Numpy’s numpy.random.exponential function for a while. I now see that Python’s random module has many functions that I didn’t know about. Does it have something that replaces numpy.random.exponential? It would be nice to drop the numpy requirement from my project.
I’ve been using Numpy’s numpy.random.exponential function for a while. I now see that Python’s
Share
If anything about
random.expovariate()does not suit your needs, it’s also easy to roll your own version:It seems a bit of an overkill to have a dependency on NumPy just for this functionality.
Note that this function accepts the mean
betaas a parameter, as does the NumPy version, whereas the parameterlambdofrandom.expovariate()is the inverse ofbeta.