Stem-and-leaf plot/Data generator: Difference between revisions

Should produce a bell curve distribution for each hump, now.
(No newlines.)
(Should produce a bell curve distribution for each hump, now.)
Line 12:
return @a;}
 
# The greater your pointcount to your width, the more pronouncedsparse your "hump" will beresult.
sub genhump
{
Line 18:
my $width = shift;
my $pointcount = shift;
my $slope = shift;
 
my $diecount = $slope;
my $range = $width / $diecount;
 
my @ret;
while(($pointcount--) > 0);
push @ret, (int(rand($width)+$offset))
{
while(($pointcount--) > 0);
my $point = $offset;
for(my $roll = 0; $roll < $diecount; ++$roll)
{
$point += rand($range * 10000) / 10000;
}
 
push @ret, (int(rand($width)+$offset)point);
}
 
return @ret;
Line 28 ⟶ 40:
my @list = ();
 
push @list, &genhump(08, 103, 305, 3);
push @list, &genhump(1512, 103, 305, 6);
 
my @shuffled = &shuffle(@list);