I need to generate a random number, to the 10th spot between 2 decimals in PHP.
Ex. A rand number between 1.2 and 5.7. It would return 3.4
How can I do this?
Advertisement
Answer
You can use:
rand ($min*10, $max*10) / 10
or even better:
mt_rand ($min*10, $max*10) / 10