Created
July 6, 2011 06:27
-
-
Save SAPikachu/1066678 to your computer and use it in GitHub Desktop.
周泰死亡率模拟
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 周泰死亡率模拟 | |
# 假设各点数出现的概率完全一样 | |
import random | |
import math | |
p = [0 for x in range(14)] | |
count = 0 | |
while True: | |
for i in range(14): | |
if random.randint(0,12) < i: | |
p[i] += 1 | |
break | |
count += 1 | |
if count >= 10000 and math.log10(count) % 1 == 0: | |
print(count, p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment