[FoRK] low probability bits

Russell Turpin russell.turpin at gmail.com
Mon Feb 23 02:47:04 PST 2009


Y'all are working too hard.

def genOnesToProb(p):
    while True:
        if p and random.random() <= p:
            yield 1
        else:
            yield 0

1s, uniformly distributed, to any desired probability p.


More information about the FoRK mailing list