.
Divya
The mt_rand() function also generates random integer but it is more powerful and generate 4 times faster than rand() function.
It using Mersenne Twister algorithm for generates random integer.
For generates high secure and faster OTP (One time Password) in our project we need mt_rand () function. For OTP integration first we need to generates a 4 digit or 6 digit number.
Let's see how to generates a 4 digit OTP with more secure and faster.
<!DOCTYPE html>
<html>
<body>
<?php
$random_number=mt_rand(1000, 9999);
echo $random_number;
?>
</body>
</html>
To generates a 6 digit OTP with more secure and faster.
<!DOCTYPE html>
<html>
<body>
<?php
$random_number=mt_rand(100000, 999999);
echo $random_number;
?>
</body>
</html>
.