PHP Mt_rand () random number function _php Tutorial

Source: Internet
Author: User
PHP Tutorial Mt_rand () random number function
Mt_rand () returns a random integer using the Mersenne twister algorithm.

Grammar
Mt_rand (Min,max) description
If no optional parameter min and Max,mt_rand () are provided, the pseudo-random number between 0 and Rand_max is returned. For example, want a random number between 5 and 15 (including 5 and 15), with Mt_rand (5, 15).

In the previous version of 3.0.7, Max was meant to be range. To get the same random number from the previous example of 5 to 15 in these versions, the short example is Mt_rand (5, 11).
*/

$rand = Mt_rand (0,1);
if ($rand ==0)
{
$array = Array (41,20,26,29,30);
}
ElseIf ($rand ==1)
{
$array = Array (38,42,37,400,444);
}

foreach ($array as $v = $VV)
{

echo "$VVN";
}


http://www.bkjia.com/PHPjc/445361.html www.bkjia.com true http://www.bkjia.com/PHPjc/445361.html techarticle The PHP tutorial Mt_rand () random number function Mt_rand () returns a random integer using the Mersenne twister algorithm. Syntax Mt_rand (MIN,MAX) illustrates if optional parameters min and max,mt_r are not provided ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.