from typing import Set
from typing import Tuple
import base64
import secrets


def gen_caseid(epoch: int, caseid_array: Set[Tuple[int, str]]) -> str:
    """randomly generates a 7-character case id and adds it to the caseid array"""
    data = base64.b32encode(secrets.token_bytes(4)).decode("utf-8")[:7]
    caseid_array.add((epoch, data))
    return data