- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
mt_rand() function in PHP
The mt_rand() function is used to generate random numbers. The numbers are generated using the Mersenne Twister algorithm.
Note − This function is faster than the rand() function
Syntax
mt_rand() or mt_rand(min, max)
Parameters
min − Default is 0.The lowest number to be Returned.
max − The highest number to be Returned.
Return
The mt_rand() function Returns a random integer between min (or 0) and max. FALSE is Returned if max < min.
Example
<?php echo mt_rand(100, 200); ?>
Output
144
Example
Let us see another example −
<?php echo mt_rand(); ?>
Output
132850920
Advertisements