random_bytes Generates cryptographically secure pseudo-random bytes &reftitle.description; stringrandom_bytes intlength Generates an arbitrary length string of cryptographic random bytes that are suitable for use in cryptography when generating salts, keys and initialization vectors. The sources of random are as follows: On Windows CryptGenRandom is used exclusively arc4random_buf is used if it is available (generally BSD specific) /dev/arandom is used where available /dev/urandom is used where none of the above is available &reftitle.parameters; length The length of the random string that should be returned in bytes. &reftitle.returnvalues; Returns a string containing the crypto-secure random bytes in binary format. &reftitle.errors; Issues an E_WARNING and returns &false; when a sufficient source of randomness is unavailable. &reftitle.examples; <function>random-bytes</function> example ]]> &example.outputs.similar; &reftitle.seealso; random_int openssl_random_pseudo_bytes bin2hex