rng.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Excalibot 作者: endreman0 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号