Random Numbers : rand « Math « PHP






Random Numbers

 
<html>
 <head>
  <title>Random Numbers</title>
 </head>
 <body>

 <?php
  srand( microtime() * 1000000 );
  $num = rand( 1, 100 );

  echo( "Microtime:" . microtime() . "<br>");
  echo( "A random number: " . $num . "<br>");
  $num = rand( 1, 100 );
  echo( "Another random number:" . $num );
 ?>

 </body>
</html>
  
  








Related examples in the same category

1.Dice Rolling Simulator
2.Generate random numbers (integer values) between 0 and MAX_RAND by calling rand() or mt_rand() without any arguments
3.int rand ( [int min, int max] ) returns random numbers
4.Random Images