import random


def sample_set(target_set, num, evict_sample=False):
    """Sample a list of random elements from a set.

    Parameters
    ----------
    target_set : set
        The set to sample.
    num : int
        The number of elements to select.
    evict_sample : boolean, optional
        Elements will be removed from the set if True.

    Returns
    -------
    list
        A list of the selected elements.
    """
    if len(target_set) == 0:
        return []
    sample_list = random.sample(target_set, min(len(target_set), num))
    if evict_sample:
        target_set.difference_update(sample_list)
    return sample_list