[SciPy-user] Generating and Sampling Random Numbers

Anne Archibald peridot.faceted at gmail.com
Thu Oct 11 18:58:11 EDT 2007


On 11/10/2007, Lorenzo Isella <lorenzo.isella at gmail.com> wrote:

> Here is my problem: in general I should not call e.g. stats.norm.rvs at
> every time step, since it amounts to continually re-initializing the
> random number generator, and any generator is guaranteed to have good
> "randomness" only within a sequence. Instead frequent initializations,
> i.e. many independent callings rather than generating a single long
> sequence, may introduce some correlations in the sampled numbers.

I think you're confused here. Unless I'm grievously mistaken, scipy's
random number generator is initialized once the first time it is used,
then all subsequent numbers are drawn from it. The normal use of
scipy's random number generators is to call them and ask for however
many random numbers you need; when you need more, call them again and
more numbers will be generated from the sequence. The array-generation
routines are a simple convenience.

Anne



More information about the SciPy-User mailing list