$min = int(rand(10)) + 15;
$max = int(rand(25));
$dayofdeath = int(rand($max)) + $min;
You're first establishing a random maximum, and then taking a random value between zero and that first random
number. This skews the day of death to lower values. I pulled this out and iterated it 2000 times and found the
following number of deaths per day, starting from day 15:
44 53 66 106 116 127 128 134 145 173 133 104 90 76 67 69 55 56 50 41 30 26 21 29 24 8 13 8 5 1 2 1
This may be construed as a feature :)
The following block (and similar blocks):
print "DAY: $days\n";
print "================\n";
print "LICE: $n\n";
print "LIVE LICE: $living\n";
print "DEAD LICE: $deathtoll\n";
print "FEMALES: $females\n";
print "MALES: $males\n";
print "EGG LAYERS (FEMALE ADULTS): $egglayers\n";
print "NYMPHS (LITTLE/YOUNG): $toddlers\n";
print "EGGS: $eggsacks\n";
print "EGGS LAID TODAY: $eggslaidtoday\n";
print "================\n";
... can be written less noisily using a heredoc:
print <<END_OF_REPORT;
DAY: $days
================
LICE: $n
LIVE LICE: $living
DEAD LICE: $deathtoll
FEMALES: $females
MALES: $males
EGG LAYERS (FEMALE ADULTS): $egglayers
NYMPHS (LITTLE/YOUNG): $toddlers
EGGS: $eggsacks
EGGS LAID TODAY: $eggslaidtoday
================
END_OF_REPORT
Off topic information on lice removal below the fold:
• another intruder with the mooring in the heart of the Perl
|