On Mon, 29 Nov 2004 20:51:50 GMT, "drs" <[EMAIL PROTECTED]> wrote:
>Is there any way to generate random numbers based on arbitrary real valued >functions? I am looking for something like random.gauss() but with natural >log and exponential functions. > >thanks, Don't know what you mean. This kind of thing? (the 1-random... is to make the random numbers in (0,1] instead of [0,1)) >>> import random >>> import math >>> math.log(1.0-random.uniform(0,1)) -0.90030288455841156 >>> math.log(1.0-random.uniform(0,1)) -0.261249141864835 >>> math.log(1.0-random.uniform(0,1)) -0.99694366818547997 Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list