in reply to Rolling DND Dice.
Then the code looks like this:
I get a nice even 12, so obviously there's some hole in my methodology.my ($sum, $rolls) = (0,0); for my $hi (1..6) { for my $mid (1..$hi) { for my $low (1..$mid) { # The drop value can be anything from 1..$low $sum += ($hi + $mid + $low) * $low; $rolls += $low; } } } printf "The average value is %g\n", $sum/$rolls;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Rolling DND Dice.
by tilly (Archbishop) on Feb 04, 2004 at 01:57 UTC | |
by Roy Johnson (Monsignor) on Feb 04, 2004 at 20:20 UTC |