If you need to generate random numbers in PHP, what method should follow? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

If you need to generate random numbers in PHP, what method should follow?

Php

23rd Jan 2021, 6:17 AM
Jahnavi Manchi
Jahnavi Manchi - avatar
2 Answers
+ 4
The rand() function generates a random integer. If you want a random integer between 10 and 100 (inclusive), use rand (10,100). The mt_rand() function produces a better random value, and is 4 times faster than rand(). https://www.w3schools.com/php/func_math_rand.asp
23rd Jan 2021, 6:44 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
rand() function
11th Feb 2021, 7:26 AM
Teju Tej
Teju Tej - avatar