From: Damien Joly Date: 2002-04-04T07:35:26+09:00 Subject: random numbers with a particualr statistical distribution Has anyone out there written code in Ruby to generate random numbers with a particular statistical distribution. I know algorithms exist in C/C++: http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf/c7-2.pdf and http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf/c7-3.pdf But it would be handy to have the common distributions available in Ruby. Generating a random deviate with mean = x and standard deviation = y is easy (see below), but the other distributions can get quite ugly. Thanks, Damien def norm(mean,sd) mean+(Math.log10((1+(2*rand()- 1))/(1-(2*rand()-1)))/1.82)*3*sd end a = norm(x,y) __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/