[SciPy-User] random.normalvariate vs scipy.stats.norm

josef.pktd@gmai... josef.pktd@gmai...
Sun Nov 28 17:45:17 CST 2010

On Sun, Nov 28, 2010 at 6:32 PM, Brennan Williams
<brennan.williams@visualreservoir.com> wrote:
> Which should I use to randomly generate normally distributed values? I
> use other scipy modules so is it recommended that I go with scipy?

scipy.stats.norm.rvs is using numpy.random. So, there is a small
overhead compared to using numpy random directly, which is not really
relevant when we create arrays of random variables.

I usually just take it from the context, if I work directly with
stats.distributions especially when the distribution is a function
argument and I need a consistent calling interface, I go with
stats.norm.rvs. If I just need normal distributed random variables, I
usually use numpy.random directly.

In most cases it doesn't make much of a difference.


> Thanks
> Brennan
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list