Re: [問卦] 13顆骰子要骰幾次才可以累積到13000點

作者: abc2090614 (casperxdd)   2017-12-26 01:12:16
※ 引述《grapherd (NULL)》之銘言:
: ※ 引述《p2p8ppp (給我錢)》之銘言:
: : https://imgur.com/7cLC5iT
: : 初學者來ㄌ
: : 我模擬1000次就跑好久
: : 是因為我用13顆骰子慢慢骰嗎?
: : 接下來要弄次數分配怎麼寫啊= =
: from collections import defaultdict
: dd = defaultdict(int)
: # 每次 result 直接放入 dd
: dd[result] += 1
: print(dd) # 次數分配結果
: 然後,已經 2017 年了,快改用 python 3 好嗎,別再用 2 了。
: : 不奢望畫圖了= =
: pyplot 或是 matplotlib 都能夠做到,加油,好嗎?
Python 模擬一萬次出來也是一樣歐
https://i.imgur.com/2HjGhzA.png
不過這個有掉到280次以下的
# python3
import numpy as np
import seaborn as sns
def roll_die():
points_total = 0
cutoff = 0
while points_total < 13000:
points_total += np.sum(np.random.randint(1, 7, 13))
cutoff += 1
return cutoff
results = np.array([roll_die() for i in range(10000)])
sns.distplot(results, kde=False)
作者: ANiZan9991 (門務司)   2016-12-26 01:12:00
我聞到臭味
作者: cena0605 (姜西拿)   2016-12-26 01:12:00
我看不懂
作者: em4 (通通去吃寶路啦><)   2017-12-26 01:13:00
常態分佈欸
作者: jim66356 (搖尾巴)   2017-12-26 01:13:00
你真的有夠無聊的
作者: tkufc (阿東)   2017-12-26 01:14:00
作者: zxasqw0246 (yoyo)   2017-12-26 01:31:00
說不定拍森的亂數表剛好是常態分佈阿
作者: Plot3D (3D做圖)   2017-12-26 01:37:00
XDDDDDDDDD

Links booklink

Contact Us: admin [ a t ] ucptt.com