import random
def random_select(lst, n):
for x in range(n):
yield random.choice(lst)
Depending on how you interpret the problem you may just want to use random.sample
import random
def random_select(lst, n):
for x in range(n):
yield random.choice(lst)
No comments:
Post a Comment