Alexey Berezuev - 4 months ago 100

PHP Question

`$a = floatval(0.0001);`

$b = floatval(0.0009);

$c = rand($a,$b); // int(0);

How can I get rand from

`$a`

`$b`

Multiplication of

`$`

`$b`

Answer

From this article:

An elegant way to return random float between two numbers:

```
function random_float ($min,$max) {
return ($min+lcg_value()*(abs($max-$min)));
}
```