src/Adapters/RandomBytesAdapter.php
public function generate()
    {
        $randomCompat = join(DIRECTORY_SEPARATOR, [
            dirname(dirname(__DIR__)), 'vendor', 'paragonie', 'random_compat', 'lib', 'random.php'
        ]);

        // PHP 5.x native
        if (version_compare(PHP_VERSION, '7.0.0', '<') && !file_exists($randomCompat)) {
            $this->function = [
                'PHP 5.x native' => 'openssl_random_pseudo_bytes'
            ];

            $bytes = openssl_random_pseudo_bytes($this->length / 2);

            if ($this->bytes === true) {
                return $bytes;
            }

            return bin2hex($bytes);
        }

        // PHP 7.x
        if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
            $this->function = [
                'PHP 7.x' => 'random_bytes'
            ];
        }

        // PHP 5.x with random_compat polyfill
        if (version_compare(PHP_VERSION, '7.0.0', '<')) {
            $this->function = [
                'PHP 5.x paragonie/random_compat' => 'random_bytes'
            ];

            require_once($randomCompat);
        }

        // Handle token generating the PHP 7.x way
        try {
            $bytes = random_bytes($this->length / 2);
        } catch (TypeError $e) {
            throw new Exception('Unexpected TypeError whilst generating the RandomBytes token: ' . $e->getMessage());
        } catch (Error $e) {
            throw new Exception('Unexpected Error whilst generating the RandomBytes token: ' . $e->getMessage());
        } catch (Exception $e) {
            throw new Exception('Could not generate RandomBytes token due to failing CSPRNG: ' . $e->getMessage());
        }

        if ($this->bytes === true) {
            return $bytes;
        }

        return bin2hex($bytes);
    }
public function generate()
    {
        $randomCompat = join(DIRECTORY_SEPARATOR, [
            dirname(dirname(__DIR__)), 'vendor', 'paragonie', 'random_compat', 'lib', 'random.php'
        ]);

        // PHP 5.x native
        if (version_compare(PHP_VERSION, '7.0.0', '<') && !file_exists($randomCompat)) {
            $this->function = [
                'PHP 5.x native' => 'openssl_random_pseudo_bytes'
            ];

            $bytes = openssl_random_pseudo_bytes($this->length / 2);

            if ($this->bytes === true) {
                return $bytes;
            }

            return bin2hex($bytes);
        }

        // PHP 7.x
        if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
            $this->function = [
                'PHP 7.x' => 'random_bytes'
            ];
        }

        // PHP 5.x with random_compat polyfill
        if (version_compare(PHP_VERSION, '7.0.0', '<')) {
            $this->function = [
                'PHP 5.x paragonie/random_compat' => 'random_bytes'
            ];

            require_once($randomCompat);
        }

        // Handle token generating the PHP 7.x way
        try {
            $bytes = random_bytes($this->length / 2);
        } catch (TypeError $e) {
            throw new Exception('Unexpected TypeError whilst generating the RandomBytes token: ' . $e->getMessage());
        } catch (Error $e) {
            throw new Exception('Unexpected Error whilst generating the RandomBytes token: ' . $e->getMessage());
        } catch (Exception $e) {
            throw new Exception('Could not generate RandomBytes token due to failing CSPRNG: ' . $e->getMessage());
        }

        if ($this->bytes === true) {
            return $bytes;
        }

        return bin2hex($bytes);
    }
Interface required method responsible for generating the token.

@return string