Stem-and-leaf plot/Data generator: Difference between revisions
Content added Content deleted
(No newlines.) |
(Should produce a bell curve distribution for each hump, now.) |
||
Line 12: | Line 12: | ||
return @a;} |
return @a;} |
||
# The greater your pointcount to your width, the more |
# The greater your pointcount to your width, the more sparse your result. |
||
sub genhump |
sub genhump |
||
{ |
{ |
||
Line 18: | Line 18: | ||
my $width = shift; |
my $width = shift; |
||
my $pointcount = shift; |
my $pointcount = shift; |
||
my $slope = shift; |
|||
my $diecount = $slope; |
|||
my $range = $width / $diecount; |
|||
my @ret; |
my @ret; |
||
⚫ | |||
⚫ | |||
{ |
|||
⚫ | |||
my $point = $offset; |
|||
for(my $roll = 0; $roll < $diecount; ++$roll) |
|||
{ |
|||
$point += rand($range * 10000) / 10000; |
|||
} |
|||
⚫ | |||
} |
|||
return @ret; |
return @ret; |
||
Line 28: | Line 40: | ||
my @list = (); |
my @list = (); |
||
push @list, &genhump( |
push @list, &genhump(8, 3, 5, 3); |
||
push @list, &genhump( |
push @list, &genhump(12, 3, 5, 6); |
||
my @shuffled = &shuffle(@list); |
my @shuffled = &shuffle(@list); |