美文网首页
模拟随机红包

模拟随机红包

作者: 潇湘demi | 来源:发表于2020-07-08 10:45 被阅读0次

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