def sample(self, ctx, qty : int, *choices):
"""Picks `{qty}` times from the choices provided, without replacement."""
count, remainder = divmod(qty, len(choices)) # Number of times through the choices, and number of choices afterward
results = []
for _ in range(count):
results.extend(random.sample(choices, k=len(choices)))
if remainder:
results.extend(random.sample(choices, k=remainder))
await ctx.send(', '.join(results))
评论列表
文章目录