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 cryptographic use, such as when generating salts, keys or initialization vectors. &csprng.sources; &csprng.function.backport; &reftitle.parameters; length The length of the random string that should be returned in bytes. &reftitle.returnvalues; Returns a string containing the requested number of cryptographically secure random bytes. &reftitle.errors; &csprng.errors; If an invalid length of bytes is given, an Error will be thrown. &reftitle.examples; <function>random_bytes</function> example ]]> &example.outputs.similar; &reftitle.seealso; random_int openssl_random_pseudo_bytes bin2hex