in reply to Randomly generating histograms
my @data; push @data, rand 1 for 1..30; # for 30 numbers my $sum; $sum += $_ for @data; # calculate sum $sum = 100 / $sum; # ratio to ensure they sum to 100 $_ *= $sum for @data; # then scale them all
-- Randal L. Schwartz, Perl hacker
|
|---|