📈 Coin Toss Streak
📐 工作原理與說明
每輪結果對映為 H(正面)或 T(反面):與當前面相同則連勝數 +1,不同則切換當前面並把連勝數重置為 1;最長連勝 = 歷史連勝數的最大值;正面佔比 = 總次數 > 0 ? round(正面次數 ÷ 總次數 × 100) + % : 顯示佔位符;重置時清空歷史、連勝、最長連勝與當前面
Simulates repeated coin tosses and tracks heads/tails streaks, showing streak counts and their distribution. A casual game that works offline.
🪙
連勝:0
點選"開始"開始拋擲
0
總數
0
本局最長
0
個人最佳
—
正面率
說明:「當前連勝」是本次會話即時值,「本局最長」是本次會話出現過的最高連勝;「個人最佳」跨局儲存在本地瀏覽器。點「重置」只歸檔本局最長、不清個人最佳;點「清除歷史記錄」會同時清空持久歷史與個人最佳。若瀏覽器停用本地儲存,個人最佳僅保留在本次會話。
📚 深度解析:拋硬幣連勝統計
💡 常見使用場景
- 機率演示:連續拋幣記錄最長同面連勝(連續正面或連續反面),感受隨機性的連段。
- 連勝記錄:挑戰同面連續最多幾次,儲存個人最佳。
- 趣味統計:對比實際分佈與理論 (1/2)^k 機率。
方法(連勝統計)
連續拋幣並記錄序列,統計最長同面連勝(連續正面或連續反面);純前端本地執行。指定的一段連續 k 次均為正面的機率為 (1/2)^k,不等於多次拋擲中出現至少一次連勝的機率。
算例(演示)
拋 18 次序列「正正反正正正正反正反正正正正正反反正」:最長連正 = 5(第 11~15 位);指定的連續 5 次均為正面的機率為 (1/2)^5=1/32≈3.13%。
❓ 常見問題(FAQ)
- 連勝會影響下一次嗎?
- 不影響。每次拋擲獨立、無記憶;「該出反面了」是賭徒謬誤,長連雖罕見但機率恆定。
- 和 coin-flip 區別?
- coin-flip 只給單次正/反;本工具記錄整段序列、統計最長連勝與分佈,適合機率演示。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Streak probability | the chance of a run of k on a given side is one half raised to k | Probability theory |
| Expected wait | the expected tosses to first see k same-side runs (either side) is two to the k minus one; for a given side it is two to the k plus one minus two | Feller, probability theory |
| Gambler fallacy | past outcomes do not change the next independent toss | Probability theory |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準