|Perl Monk, Perl Meditation|
custom random number generatorby Anonymous Monk
|on Nov 29, 2011 at 15:36 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
i'm working on a perl script and i need a very specific random number generator.
what i have right now is multrand. it returns a random number between x/y and x*y, with the median result being x. half the time less than x, half the time, greater than x.
i want to build a sub that returns a random in the same range, but with the result more likely to be closer to x.
with a simple random, i'd just run the sub z times and return result/z. graph the results of that, and you get a bell curve.
the results/z method won't work here because i still want the results to be half the time less than x and half the time greater than x.