Jump to: navigation, search

Php mt rand

From w3cyberlearnings

Contents

PHP function mt_rand

This function returns a random number as what rand() function. However, this function is four time faster that the average rand() function.

Syntax mt_rand

  • min (optional): the lowest value to return
  • max (optional): the largest value to return
mt_rand();

OR

mt_rand(min,max);

Example 1

<?php

echo mt_rand();
echo "<br/>";
echo mt_rand();
echo "<br/>";
echo mt_rand(8,18);

?>

Output

451985104
453871630
17


Related Links


Navigation
Web
SQL
MISC
References