import random


def random_subset(n):
    """Returns a random subset with cardinality at least two of the elements
    {0, ..., n}."""
    I = set()
    while len(I) <= 1:
        I = set(i for i in range(n+1) if random.randint(0,1))
    return I