You need to get a random number in the range from 00.00 to 100.00
Is there a solution for this question?
You need to get a random number in the range from 00.00 to 100.00
Is there a solution for this question?
Thanks for the decision @ Ipatiev. Slightly modified code:
return number_format(rand(0, 10000) / 100, 2, '.', ''); Try this solution.
function random_float ($min,$max) { return ($min+lcg_value()*(abs($max-$min))); } 23.388192741654 - Vismanround($var, 2); Complicated? - Dmitry GvozdCode
echo rand(0, 10000)/100; generates numbers from 0 to 100, with a maximum of 2 decimal places.
Code with rounding
echo round(rand(0, 10000)/100,2); redundant. Test here http://sandbox.onlinephpfunctions.com/code/c5cebbfd6357874724f07708ad22e8c52055087f
Source: https://ru.stackoverflow.com/questions/559835/
All Articles
floatand usinground- Dmitriy Gvozdecho round(rand(0, 10000)/100,2);- Ipatiev