Re: simple probability problem using PERL

2004-01-26 Thread Steve Grazzini
Charles Lu wrote: If I want to randomly generate a dice (4 side) roll, I can use the following expression: $roll = 1 + int( rand(4)); This assumes that every side of this dice has equal chance of being rolled (0.25). Thats easy. Now What if I say, that the probability of rolling a 3 is 70

RE: simple probability problem using PERL (long)

2004-01-25 Thread Charles K. Clarkson
Charles Lu <[EMAIL PROTECTED]> wrote: : : If I want to randomly generate a dice (4 side) roll, I can use : the following expression: : : $roll = 1 + int( rand(4)); : : This assumes that every side of this dice has equal chance of : being rolled (0.25). Thats easy. Now What if I say, that th

Re: simple probability problem using PERL

2004-01-24 Thread drieux
On Jan 24, 2004, at 3:31 PM, Charles Lu wrote: $probability = { '1' => 0.1, '2' => 0.1, '3' => 0.7, '4 => 0.1 } What if you did it the other way around? my $probability= {0 => 1, 1 => 2, 9 => 4};

Re: simple probability problem using PERL

2004-01-24 Thread James Edward Gray II
On Jan 24, 2004, at 5:31 PM, Charles Lu wrote: Hi If I want to randomly generate a dice (4 side) roll, I can use the following expression: $roll = 1 + int( rand(4)); This assumes that every side of this dice has equal chance of being rolled (0.25). Thats easy. Now What if I say, that th

simple probability problem using PERL

2004-01-24 Thread Charles Lu
Hi If I want to randomly generate a dice (4 side) roll, I can use the following expression: $roll = 1 + int( rand(4)); This assumes that every side of this dice has equal chance of being rolled (0.25). Thats easy. Now What if I say, that the probability of rolling a 3 is 70% and the pro