public static function randomBytes($length = 16)
    {
        if (function_exists('random_bytes')) {
            $bytes = random_bytes($length);
        } elseif (function_exists('openssl_random_pseudo_bytes')) {
            $bytes = openssl_random_pseudo_bytes($length, $strong);
            if (false === $bytes || false === $strong) {
                throw new RuntimeException('Unable to generate random string.');
            }
        } else {
            throw new RuntimeException('OpenSSL extension is required for PHP 5 users.');
        }

        return $bytes;
    }
public static function randomBytes($length = 16)
    {
        if (function_exists('random_bytes')) {
            $bytes = random_bytes($length);
        } elseif (function_exists('openssl_random_pseudo_bytes')) {
            $bytes = openssl_random_pseudo_bytes($length, $strong);
            if (false === $bytes || false === $strong) {
                throw new RuntimeException('Unable to generate random string.');
            }
        } else {
            throw new RuntimeException('OpenSSL extension is required for PHP 5 users.');
        }

        return $bytes;
    }
public static function randomBytes ( $ length = 16 ) { if ( function_exists ( 'random_bytes' ) ) { $ bytes = random_bytes ( $ length ) ; } elseif ( function_exists ( 'openssl_random_pseudo_bytes' ) ) { $ bytes = openssl_random_pseudo_bytes ( $ length , $ strong ) ; if ( false === $ bytes || false === $ strong ) { throw new RuntimeException ( 'Unable to generate random string.' ) ; } } else { throw new RuntimeException ( 'OpenSSL extension is required for PHP 5 users.' ) ; } return $ bytes ; }
Generate a more truly "random" bytes.

@param int $length

@return string

@throws RuntimeException

@codeCoverageIgnore

@throws \Exception
Generate a more truly random bytes .