in reply to Randomly generating histograms

That's easy. Generate as many as you want, all from 0 to 1. Then take their sum, and go back and multiply each element by 100 divided by that sum!
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