def hongbao(money,num):
import random
choice = random.sample(range(1,money*100),num-1)
choice.extend([0,100*money])
choice.sort()
print(choice)
return [(choice[i+1]-choice[i])/100 for iin range(0,num)]
if __name__ =='__main__':
print(hongbao(50,8))
def hongbao(money,num):
import random
choice = random.sample(range(1,money*100),num-1)
choice.extend([0,100*money])
choice.sort()
print(choice)
return [(choice[i+1]-choice[i])/100 for iin range(0,num)]
if __name__ =='__main__':
print(hongbao(50,8))
本文标题:模拟随机红包
本文链接:https://www.haomeiwen.com/subject/kemqcktx.html
网友评论