Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 00e2389

Browse files
authoredJun 14, 2024··
Update outcome_of_rolling_n_sided_dice_k_time.py
1 parent e4129b9 commit 00e2389

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed
 

‎maths/outcome_of_rolling_n_sided_dice_k_time.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ def outcome_of_rolling_n_sided_dice_k_time(n_side: int, k_time: int) -> list:
77
This function returns a list. The first element is an array.
88
That array contains indexes.
99
The second element is another array.
10-
That array contains probabilities for each index value.
10+
That array contains probabilities for getting each index values
11+
as the sum of obtained side values.
1112
1213
Algorithm Explanation:
1314
@@ -47,8 +48,6 @@ def outcome_of_rolling_n_sided_dice_k_time(n_side: int, k_time: int) -> list:
4748
with the sum. The same sum can come in many combinations.
4849
Finding all of those combinations and applying Bernoulli
4950
is more computationally extensive.
50-
c) The algorithm can be used in playing games where the sum of
51-
multiple dice throwing is needed.
5251
5352
I used that method in my paper to draw the distribution
5453
Titled: Uncertainty-aware Decisions in Cloud Computing:
@@ -75,12 +74,12 @@ def outcome_of_rolling_n_sided_dice_k_time(n_side: int, k_time: int) -> list:
7574
>>> outcome_of_rolling_n_sided_dice_k_time(4,2)
7675
[range(2, 9),
7776
array([0.0625, 0.125 , 0.1875, 0.25 , 0.1875, 0.125 , 0.0625])]
78-
>>> outcome_of_rolling_n_sided_dice_k_time(6,2)
77+
>>> probability_of_n_heads_in_m_tossing(6,2)
7978
[range(2, 13),
8079
array([0.02777778, 0.05555556, 0.08333333, 0.11111111, 0.13888889,
8180
0.16666667, 0.13888889, 0.11111111, 0.08333333, 0.05555556,
8281
0.02777778])]
83-
>>> outcome_of_rolling_n_sided_dice_k_time(6,3)
82+
>>> probability_of_n_heads_in_m_tossing(2,3)
8483
[range(3, 19),
8584
array([0.00462963, 0.01388889, 0.02777778, 0.0462963 , 0.06944444,
8685
0.09722222, 0.11574074, 0.125 , 0.125 , 0.11574074,

0 commit comments

Comments
 (0)
Please sign in to comment.