Random Numbers in Perl
Here’s a super simple way to generate a random number in your perl scripts:
srand (time ^ ($$ + ($$ << 15)));
my $random_number = int(rand(30000)) + 55000 ;
print “random = $random_number\n” ;
You can play with the numeric values in line 2 to get the range of numbers you want.
Leave a comment
You must be logged in to post a comment.