What are the best practices for ensuring secure and cryptographically safe random number generation in PHP?

To ensure secure and cryptographically safe random number generation in PHP, it is recommended to use the `random_bytes()` function provided by PHP for generating random bytes. This function uses the operating system's random number generator, which is considered secure for cryptographic purposes.

$randomBytes = random_bytes(16); // Generate 16 random bytes
$randomNumber = hexdec(bin2hex($randomBytes)); // Convert the random bytes to a secure random number
echo $randomNumber;