<div dir="ltr"><div>Thanks, St?fan, speed: N ~ 1e9. Thanks again.<br><br></div>DG<br><div><div><br>----------------------------------------------------------------------<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Message: 1<br>
Date: Sun, 22 Sep 2013 14:04:09 -0700<br>
From: David Goldsmith <<a href="mailto:d.l.goldsmith@gmail.com">d.l.goldsmith@gmail.com</a>><br>
Subject: [Numpy-discussion] Generating a (uniformly distributed)<br>
random bit list of length N<br>
To: <a href="mailto:numpy-discussion@scipy.org">numpy-discussion@scipy.org</a><br>
Message-ID:<br>
<<a href="mailto:CAFtPsZqG7Upjy8s04NPwkn8gJVDVGORu3rPjCVLN6ZKRWnPuTQ@mail.gmail.com">CAFtPsZqG7Upjy8s04NPwkn8gJVDVGORu3rPjCVLN6ZKRWnPuTQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Is np.random.randint(2, size=N) the fastest way to do this? Thanks!<br>
<br>
DG<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130922/b3cebeaa/attachment-0001.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130922/b3cebeaa/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Mon, 23 Sep 2013 03:22:06 +0200<br>
From: St?fan van der Walt <<a href="mailto:stefan@sun.ac.za">stefan@sun.ac.za</a>><br>
Subject: Re: [Numpy-discussion] Generating a (uniformly distributed)<br>
random bit list of length N<br>
To: Discussion of Numerical Python <<a href="mailto:numpy-discussion@scipy.org">numpy-discussion@scipy.org</a>><br>
Message-ID:<br>
<<a href="mailto:CABDkGQkq829A_nJ7xxCS5Xauz-pTWcyf_zBsLt%2B0gUFNzWyDaA@mail.gmail.com">CABDkGQkq829A_nJ7xxCS5Xauz-pTWcyf_zBsLt+0gUFNzWyDaA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
On 22 Sep 2013 23:04, "David Goldsmith" <<a href="mailto:d.l.goldsmith@gmail.com">d.l.goldsmith@gmail.com</a>> wrote:<br>
><br>
> Is np.random.randint(2, size=N) the fastest way to do this? Thanks!<br>
<br>
Are you concerned about speed or memory use? The operation you show should<br>
already be quite fast. A more memory efficient approach would be to<br>
generate integers and use their binary representation.<br>
<br>
St?fan<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130923/e4f56af4/attachment-0001.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130923/e4f56af4/attachment-0001.html</a><br>
<br>
</blockquote></div><br></div></div></div></div>