PHP Generate Random Float Number

0
PHP Generate Random Float Number
4.5 (90%) 4 votes

This function help you generate a random float number like: 5.99, 10.22, 6.55 …
You can easy set min and max for random float number.

This is function generate a random float number between 2 min and max number you set.

How to use:
Just set a min number and max number (we can use float for both min and max number). For example, if we want to generate a random float number between 0 and 1, then code should be:

Result should be:

0.82

Another fullcode which generate a random float number between 1 and 10:

Result should be:

8.82

 

Last update: 11:39:21 AM, 18th December 2017
Share.

About Author

Leave A Reply