in reply to New Jersey Lottery Probability
Commenting out 'use integer' does slow it down. In its defense, it does avoid a type overflow which gave me an incorrect result of 563108608.#!/usr/bin/perl -w use strict; # use integer; my $probability = permutation(50,5); print ($probability * 36); sub permutation { my $probability = 1; my ($number, $times) = @_; print "The times is $times and the number is $number.\n"; while ($times-- > 0) { $probability *= $number; $number--; } return $probability; }
For what it's worth, I have a different type of lottery script generating data at my homepage. I can post it, as it might be interesting.
|
|---|