in reply to RE: Need help with number generator
in thread Need help with number generator
There are several answers there, including mine at Re: How do I get random numbers that follow standard distribution?.
UPDATE
After talking with you I found that you have two rather
irritating conditions. You cannot easily install modules,
and you want to skew the output. Here is some sample code
that gives you an idea how to do that, but I am warning
you that it will take a lot of playing around to get this
to produce what you want...
my @weights = qw(0.5 1 2); my @random = sort {$a <=> $b} map{rand()} 0..$#weights; my $tot; foreach (0..$#weights) { $tot += $random[$_] * $weights[$_]; } print $tot;
|
|---|