import random def red_packet(money, num): money = money * 100 ret = random.sample(range(1, money), num - 1) ret.append(0) ret.append(money) ret.sort() return [(ret[i+1]- ret[i]) / 100 for i in range(len(ret) - 1)]
2023-10-29 14:31:40
import random def red_packet(money, num): money = money * 100 ret = random.sample(range(1, money), num - 1) ret.append(0) ret.append(money) ret.sort() return [(ret[i+1]- ret[i]) / 100 for i in range(len(ret) - 1)]
下一篇:微信公众号侧滑按钮