Alexey Berezuev - 10 months ago 167

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 Source

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)));
}
```