import secrets


def random_partition(keys, p):
    """Return a dict with keys such that values are a random partition of p.

    Parameters
    ----------
    keys : list of str
    p : int

    Returns
    -------
    result : dict
        keys : str
        values : int

    Notes
    -----
    each value of the dict should be greater than or equal 1

    Example
    -------
    >>> partition(['alphanumeric','hexdigits','symbols'],7)
    {'alphanumeric': 1, 'hexdigits': 2, 'symbols': 4}
    """
    n = len(keys)
    # Each key should at least have one character
    values = [1] * n
    p -= n
    for _ in range(p):
        i = secrets.randbelow(n)
        values[i] += 1
    result = {keys[i]: values[i] for i in range(n)}
    return result