Are there any alternatives to rand() function in PHP for generating random numbers?

The rand() function in PHP can sometimes be predictable and not truly random. An alternative to this function is to use the random_int() function, which generates cryptographically secure random integers. This function provides a more reliable way to generate random numbers in PHP.

$randomNumber = random_int($min, $max);
echo $randomNumber;