drs 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.

scipy[1] has a large collection of "standard" univariate pdfs, including normal, exponential, gamma, and the like.


One cannot generate random numbers from arbitrary real valued functions because a function needs to satisfy certain restrictions to be a pdf. For example, you cannot generate random numbers "with a log function", unless you restrict the domain and renormalize.

Generating random numbers from an arbitrary pdf is possible, but tricky. I encourage you to search the literature for "monte carlo sampling."

[1] http://www.scipy.org

--
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to