From: "Mauricio Fernández" Date: 2004-08-14T17:07:13+09:00 Subject: Re: Random variable library? On Sat, Aug 14, 2004 at 03:43:36PM +0900, Gavin Sinclair wrote: > On Friday, August 13, 2004, 5:41:22 PM, Mauricio wrote: > > > On Fri, Aug 13, 2004 at 11:26:22AM +0900, Gavin Sinclair wrote: > >> The work I'm doing now doesn't strictly require, but would benefit from a > >> random number generator that: > >> - obeyed the distribution you want, with the parameters you want > > > You can do that easily by taking a uniform random variable and feeding > > it into the distribution function you want. > > Thanks for the tip. How do you write a distribution function? Well, that's more or less what the rand.rb mentioned somewhere else in this thread does, at least for some distributions. Basically, once you know the probability density function you want, you integrate it to obtain the distribution function. Note that in some cases the pdf. cannot be integrated analytically, so you'd have to either generate an instance of the random var through other means or use some numerical approximations. After a surprisingly long search (compared to what one is used to regarding google :) I found the following: http://www.causascientia.org/math_stat/Dists/Compendium.pdf -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com