import secrets
import string


def generate_random_string(n: int) -> str:
    """ Generate a random string (ascii and 0 - 9) of variable length. Can be used to encrypt file names and keys etc.

    Arguments:
        n (int): an integer that determines the random string length

    Returns:
        str, the random string that was generated

    """

    return "".join(secrets.choice(string.ascii_letters+string.digits) for __ in range(n))