We can make it a number of 1-30 and put it in 10.
& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)
$num? =? Rand (1, 30)/10;
Echo? $num
& gt at this time, the value of num is a random floating point number in 0. 1-3.0.
Usage of rand () function
int? Rand? (? int? $min? ,? int? $max? )
These parameters are:
department
Lowest value returned (default: 0)
maximum
Maximum value returned (default: getrandmax ())
For other ways to use the rand () function, please visit the official document: PHP document.