public function generate($size)
    {
        try {
            $generated = random_bytes($size);
        } catch (Error $e) {
            // PHP 7+ will throw an `Error`. Catch here to make sure that we don't accidentally catch a polyfilled
            // `Error` from a polyfill library, such as https://github.com/paragonie/random_compat
            throw $e;
        } catch (Exception $e) {
            throw CryptographicFailureException::forReasonCode(
                CryptographicFailureException::CODE_FOR_RANDOM_DATA_GENERATION_FAILURE,
                $e
            );
        }

        return $generated;
    }
public function generate($size)
    {
        try {
            $generated = random_bytes($size);
        } catch (Error $e) {
            // PHP 7+ will throw an `Error`. Catch here to make sure that we don't accidentally catch a polyfilled
            // `Error` from a polyfill library, such as https://github.com/paragonie/random_compat
            throw $e;
        } catch (Exception $e) {
            throw CryptographicFailureException::forReasonCode(
                CryptographicFailureException::CODE_FOR_RANDOM_DATA_GENERATION_FAILURE,
                $e
            );
        }

        return $generated;
    }
{@inheritDoc}