What are some best practices for generating random numbers in PHP, especially for tasks like selecting lottery numbers?

When generating random numbers in PHP, especially for tasks like selecting lottery numbers, it is important to ensure that the numbers are truly random and not predictable. One way to achieve this is by using the `random_int()` function, which generates cryptographically secure random integers. Additionally, it is recommended to seed the random number generator using `random_int()` or `mt_srand()` to further improve randomness.

// Generate a random number between 1 and 49 for lottery numbers
$lottery_number = random_int(1, 49);
echo $lottery_number;