[Numpy-discussion] Generating a (uniformly distributed) random bit list of length N

Stéfan van der Walt stefan at sun.ac.za
Sun Sep 22 21:22:06 EDT 2013

On 22 Sep 2013 23:04, "David Goldsmith" <d.l.goldsmith at gmail.com> wrote:
> Is np.random.randint(2, size=N) the fastest way to do this?  Thanks!

Are you concerned about speed or memory use? The operation you show should
already be quite fast. A more memory efficient approach would be to
generate integers and use their binary representation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130923/e4f56af4/attachment.html>

More information about the NumPy-Discussion mailing list