Jan 10, 2023
In this tutorial, we will see how to get the random float number using the rand() function in PHP, along with knowing its implementation through the example. The rand() is an inbuilt function in PHP used to generate a random float number.
The rand() function is used to generate a random float number. To generate a random float in some range.
In this example, we will use the rand() function. Create a function to generate a random float number. It will generate different float numbers between the 1 and 10 range.
//Get random float numbers
$randomFloat = rand(1, 10) / 10;
//print random float numbers
I hope it can help you...