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

David Goldsmith d.l.goldsmith at gmail.com
Mon Sep 23 15:25:12 EDT 2013


Thanks, St?fan, speed: N ~ 1e9.  Thanks again.

DG

----------------------------------------------------------------------

>
> Message: 1
> Date: Sun, 22 Sep 2013 14:04:09 -0700
> From: David Goldsmith <d.l.goldsmith at gmail.com>
> Subject: [Numpy-discussion] Generating a (uniformly distributed)
>         random bit      list of length N
> To: numpy-discussion at scipy.org
> Message-ID:
>         <
> CAFtPsZqG7Upjy8s04NPwkn8gJVDVGORu3rPjCVLN6ZKRWnPuTQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Is np.random.randint(2, size=N) the fastest way to do this?  Thanks!
>
> DG
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130922/b3cebeaa/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Mon, 23 Sep 2013 03:22:06 +0200
> From: St?fan van der Walt <stefan at sun.ac.za>
> Subject: Re: [Numpy-discussion] Generating a (uniformly distributed)
>         random bit list of length N
> To: Discussion of Numerical Python <numpy-discussion at scipy.org>
> Message-ID:
>         <
> CABDkGQkq829A_nJ7xxCS5Xauz-pTWcyf_zBsLt+0gUFNzWyDaA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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.
>
> St?fan
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130923/e4f56af4/attachment-0001.html
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130923/e0156f7e/attachment.html>


More information about the NumPy-Discussion mailing list