public static function randomHex(int $length = 128): string
    {
        $bytes = ceil($length / 2);
        $hex = bin2hex(self::randomBytes($bytes));
        return $hex;
    }
public static function randomHex(int $length = 128): string
    {
        $bytes = ceil($length / 2);
        $hex = bin2hex(self::randomBytes($bytes));
        return $hex;
    }
public static function randomHex ( int $ length = 128 ) : string { $ bytes = ceil ( $ length / 2 ) ; $ hex = bin2hex ( self :: randomBytes ( $ bytes ) ) ; return $ hex ; }
Returns a random hex of desired length.

@param int $length
@throws \Exception
@return string
Returns a random hex of desired length .