Feb 142010
Generate random number in Perl
Answer:
To generate a random number in Perl, e.g. 10 to 20 (inclusive)
my $max = 10;
my $min = 10;
my $random = int( rand( $max-$min +1 ) ) + $min;
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Generate random number in Perl
Answer:
To generate a random number in Perl, e.g. 10 to 20 (inclusive)
my $max = 10;
my $min = 10;
my $random = int( rand( $max-$min +1 ) ) + $min;