Conditions | 3 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public static function randomFloat(float $minValue = 0.0, float $maxValue = 1000.0, int $decimalPlace = 1): float |
||
39 | { |
||
40 | |||
41 | // Decimal place can be from 1 to 5 |
||
42 | $decimalPlace = ($decimalPlace > 0 && $decimalPlace <= 5) ? $decimalPlace : 1; |
||
43 | |||
44 | $divider = (int) pow(10, $decimalPlace); |
||
45 | |||
46 | return rand(($minValue * $divider), ($maxValue * $divider)) / $divider; |
||
47 | } |
||
85 |