Problems? Is your data what you think it is? | |
PerlMonks |
Re^2: Monte Carlo - Coin Tossby jwkrahn (Abbot) |
on Mar 12, 2011 at 01:22 UTC ( [id://892772]=note: print w/replies, xml ) | Need Help?? |
It is more idiomatic (and often simpler) to use Perl-style rather than C-style loops. Yes, but it won't work if the numbers are too large for integers and have to use floating point. Then only C style loops will work.
Why are you initializing @collect with NUM_TOSSES + 1 elements? The idiomatic way to initialize @collect with NUM_TOSSES elements is usually:
You have an off-by-one error, it should be:
Update: oops, I misread the original code.
In Section
Cool Uses for Perl
|
|