How to use mt rand in PHP

This article describe about mt_rand() Function in PHP.
  • 1796

mt_rand() Function

By using the Mersenne Twister algorithm mt_rand() function return a random interger.

This function return Pseudo-random value between 0 and RAND_MAX if function is called without parameters.

You can use mt_rand(10,100), if you want a random number between 10 and 100.


mt_rand(min, max)


Parameter Description
min, max Option. It define the range between random number lie.

Note: The mt_rand() function is more better then rand() function for return random value.


echo(mt_rand() . "<br />");
echo(mt_rand() . "<br />");




You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.