坦克世界2021假日行动开箱概率模拟测试(仅供娱乐)
2021-12-09 02:21 作者:carbonsunsu | 我要投稿
Python代码如下:
import random
boxCount = 100000000
premTankCount = 0
count0to49 = 0
for i in range(1, boxCount + 1):
if (count0to49 == 49):
count0to49 = 0
premTankCount += 1
else:
if random.randint(1, 1000) <= 24:
count0to49 = 0
premTankCount += 1
else:
count0to49 += 1
'''
if random.randint(1, 1000) <= 24:
premTankCount += 1
'''
print("开箱子总数: " + str(boxCount))
print("开出金币车的数量: " + str(premTankCount))
print("平均每50个箱子开出金币车的个数: " + str(premTankCount / (boxCount / 50)))
开1亿个箱子的结果,仅考虑8金:
所以结论是平均每50个箱子能开出1.7个金币车

最后祝大家这次开箱一单毕业