import random


def choose(i, k, thresh):
    """Sample from set i, k times, ensuring sum of k !> threshold"""
    if min(i) * k >= thresh: raise ValueError
    l = [thresh]
    while sum(l) >= thresh:
        l = random.choices(i, k=k)
    return l