How does one generate a random float between 0 and 1 in PHP?
I\'m looking for the PHP\'s equivalent to Java\'s Math.random().
Math.random()
Solution for PHP 7. Generates random number in [0,1). i.e. includes 0 and excludes 1.
[0,1)
function random_float() { return random_int(0, PHP_INT_MAX-1)/PHP_INT_MAX; }