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?
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?
A more general solution would be:
You can use:
or even better:
You could do something like:
PHP's random function allows you to only use integer limits, but you can then divide the resulting random number by 10.