[Numpy-discussion] in place random generation
Wed Mar 7 15:51:23 CST 2007
On 3/7/07, Robert Kern <firstname.lastname@example.org> wrote:
> Daniel Mahler wrote:
> > Is there an efficient way to fill an existing array with random
> > numbers without allocating a new array?
> No, sorry.
There is however an only moderately inefficient way if you are primarily
concerned with keeping your total memory usage down for some reason. In that
case, you can fill your array in chunks; for example getting 1000 random
numbers at a time from random.random and successively copying them into your
array. It's probably not worth the trouble unless you have a really big
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion