Extracted the random byte generation logic into a separate function (generateRandomBytes).
Removed unnecessary variable initialization ($rnd = false;).
Combined the openssl_random_pseudo_bytes check and assignment into one statement.
Added a default case in the generateRandomBytes function to return false if no secure random function is available.
Extracted the random byte generation logic into a separate function (generateRandomBytes). Removed unnecessary variable initialization ($rnd = false;). Combined the openssl_random_pseudo_bytes check and assignment into one statement. Added a default case in the generateRandomBytes function to return false if no secure random function is available.