Generate random numbers : rand « System Functions « Perl






Generate random numbers

      

#!/usr/bin/perl 
print "Content-Type: text/html \n\n"; 
$random_number = rand(10); 
print "<p>Your Auto Lucky Number from 1 to 10 is $random_number.</p>\n"; 
$random_integer = int(rand(10)) + 1; 
print "<p>Your Auto Lucky Integer from 1 to 10 is $random_integer.</p>\n"; 
print "Click the Reload button on your browser to get a new random number."; 

   
    
    
    
    
    
  








Related examples in the same category

1.Using foreach loop to create a list of random number
2.Random integers produced by 1 + int( rand( 6 ) )
3.Random numbers produced by rand( 100 )
4.Random numbers produced by rand()
5.Let system determine seed
6.Combine rand function and letter range to generate random letter
7.Seed rand with the time or the pid of this process
8.Formula to produce random numbers between 5 and 15 inclusive
9.A program that generates random integers between 1 and 10.