in reply to Need help with number generator

here's another approach that assumes rand is actually random, which it technically isn't (see Math::TrulyRandom):
my $seed=rand; my $result=($seed>=0) + ($seed>=.8) + ($seed>=.9); print "$result\n";


BlueLines

Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.