[Numpy-discussion] random number genration

Alex Ter-Sarkissov ater1980@gmail....
Tue Mar 29 04:00:35 CDT 2011


If I want to generate a string of random bits with equal probability I run

random.randint(0,2,size).

What if I want a specific proportion of bits? In other words, each bit is 1
with probability p<1/2 and 0 with probability q=1-p?

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110329/beb49b5b/attachment.html 


More information about the NumPy-Discussion mailing list