This should work ...

#!/usr/bin/perl -w

my $num = int (rand(10) +1);
if ($num >= 5 and $num <= 10) {
        print "$num\n";
}
else {
        print "Sorry ... \n";
}

Hope that helps ...
Adam

On Saturday 20 September 2003 12:58 pm, dan wrote:
: how is it possible to get a random number between x and y? in know
: int(rand(10)) returns an integer between 0 and 9, but how do i get it so
: that i can get a random integer say between 5 and 10 inclusive?
:
: many thanks
:
: dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to