WordPress at a glance
function is not described

random_bytes() WP 1.0

If the libsodium PHP extension is loaded, we'll use it above any other solution.

libsodium-php project:

No Hooks.

Return

String.

Usage

random_bytes( $bytes );
$bytes(int) (required)

Code of random bytes: wp-includes/random_compat/random_bytes_libsodium_legacy.php VER 5.1.1

<?php
function random_bytes($bytes)
{
    try {
        $bytes = RandomCompat_intval($bytes);
    } catch (TypeError $ex) {
        throw new TypeError(
            'random_bytes(): $bytes must be an integer'
        );
    }

    if ($bytes < 1) {
        throw new Error(
            'Length must be greater than 0'
        );
    }

    /**
     * @var string
     */
    $buf = '';

    /**
     * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
     * generated in one invocation.
     */
    if ($bytes > 2147483647) {
        for ($i = 0; $i < $bytes; $i += 1073741824) {
            $n = ($bytes - $i) > 1073741824
                ? 1073741824
                : $bytes - $i;
            $buf .= Sodium::randombytes_buf((int) $n);
        }
    } else {
        $buf .= Sodium::randombytes_buf((int) $bytes);
    }

    if (is_string($buf)) {
        if (RandomCompat_strlen($buf) === $bytes) {
            return $buf;
        }
    }

    /**
     * If we reach here, PHP has failed us.
     */
    throw new Exception(
        'Could not gather sufficient random data'
    );
}