Find Random number between two given numbers - Perl

random number

Snippet Code


  
Rate this page :
  [ 0 votes]

#!/usr/bin/perl print "content-type:text/htmlnn"; sub random_int_between { my($min, $max) = @_; # Assumes that the two arguments are integers themselves! return $min if $min == $max; ($min, $max) = ($max, $min) if $min > $max; return $min + int rand(1 + $max - $min); } $res = random_int_between(50,120); print "Random number is : $res"; <br

Tags


Ask Questions

Ask Question