import random


def generate_subset(any_set):
    """
    Randomly samples a subset for a given any_set. To be used for sampling
    attributes in the equivalence oracle.
    Parameters:
    -----------------------------------
    any_set : set
        The set whose subsets are to be generated

    Returns:
    -----------------------------------
    subset : set
        The randomly sampled subset of any_set
    """
    subset = set()
    random.shuffle(any_set)
    for element in any_set:
        if random.random() > 0.5:
            subset.add(element)
    return(subset)