What potential pitfalls should be avoided when using PHP to generate random numbers?

One potential pitfall to avoid when using PHP to generate random numbers is using the rand() function, which is not cryptographically secure and can lead to predictable or biased results. To generate secure random numbers, it is recommended to use the random_int() function instead, which provides a more secure source of randomness.

$randomNumber = random_int(1, 100);
echo $randomNumber;