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

no edit summary
(Should produce a bell curve distribution for each hump, now.)
No edit summary
Line 15:
sub genhump
{
my ($offset, $width, $pointcount, $slope) = shift@_;
my $width = shift;
my $pointcount = shift;
my $slope = shift;
 
my $diecount = $slope;
Line 24 ⟶ 21:
 
my @ret;
foreach (1 .. $pointcount)
while($pointcount-- > 0)
{
my $point = $offset;
forforeach (my1 $roll = 0; $roll <.. $diecount; ++$roll)
{
$point += rand($range * 10000) / 10000;
Line 38 ⟶ 35:
}
 
my @list = (&genhump(8, 3, 5, 3);,
push @list, &genhump(12, 3, 5, 6));
 
push @list, &genhump(8, 3, 5, 3);
push @list, &genhump(12, 3, 5, 6);
 
my @shuffled = &shuffle(@list);
 
print "$_ @shuffled\n";</lang>
foreach ( @shuffled );
</lang>
Anonymous user