1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl my ($x, $y, $density) = @ARGV; print "$y.ox\n"; for (my $i = 0; $i < $y; $i++) { for (my $j = 0; $j < $x; $j++) { if (int(rand($y) * 2) < $density) { print "o"; } else { print "."; } } print "\n"; }