Robert Kern wrote: > [numpy implementation snipped] > Ed Schofield has an implementation of an algorithm by Marsaglia[1] which turns > sampling into a fast table lookup. If your probabilities have limited > precision > (2**-30 or so rather than the full double precision 2**-52 or so), then this > might be an attractive option. > > [1] http://www.jstatsoft.org/v11/i03/v11i03.pdf >
Thanks a lot for the numpy implementation and for the literature reference! I'll try to figure out how little precision I need in my sampling. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list