agent-0 / augmentoolkit /utils /sample_and_remove.py
Leon4gr45's picture
Upload folder using huggingface_hub
42da440 verified
Raw History Blame Contribute Delete
203 Bytes
import random
def sample_and_remove(lst, n):
sampled = []
for _ in range(min(n, len(lst))):
index = random.randrange(len(lst))
sampled.append(lst.pop(index))
return sampled