【原神】祈愿概率計(jì)算
對(duì)祈愿的概率進(jìn)行了計(jì)算,和官方公布的好像有點(diǎn)出入。
不知道是不是計(jì)算錯(cuò)誤還是本身抽獎(jiǎng)邏輯中隱藏了額外算法。

祈愿規(guī)則:
「奔行世間」常駐祈愿為永久性祈愿活動(dòng),玩家可以抽取非限定角色與武器。
在本祈愿內(nèi),每10次祈愿必會(huì)獲得至少1個(gè)4星或以上物品。
※一般情況下所有角色或武器均適用基礎(chǔ)概率,如觸發(fā)概率UP、保底等以具體規(guī)則為準(zhǔn)。
〓祈愿規(guī)則〓
規(guī)則1:5星物品祈愿的基礎(chǔ)概率為0.600%,綜合概率(含保底)為1.600%,最多90次祈愿必定能通過(guò)保底獲取5星物品。
規(guī)則2:4星物品祈愿的基礎(chǔ)概率為5.100%,綜合概率(含保底)為13.000%,最多10次祈愿必定能通過(guò)保底獲取4星或以上物品。

根據(jù)出現(xiàn)5星或4星重置保底次數(shù),寫(xiě)了程序模擬抽取以后發(fā)現(xiàn):
1.90連保底觸發(fā),重置90連保底次數(shù)。
2.90連保底觸發(fā)/10連保底觸發(fā),如果重置10連保底次數(shù)依然無(wú)法計(jì)算出官方的綜合幾率。
3.10連保底如果不受90次保底觸發(fā)重置次數(shù)/不受基礎(chǔ)記錄抽出4星重置10連保底次數(shù),則可以模擬到官方計(jì)算的綜合保底概率。(10連保底重置條件:觸發(fā)10連保底出現(xiàn)4星,基礎(chǔ)概率出現(xiàn)4星或以上不觸發(fā)次數(shù)重置,90連保底不觸發(fā)次數(shù)重置)
4.按照3規(guī)則,可以計(jì)算出,如果觸發(fā)10連保底,出現(xiàn)5星概率約6%,出現(xiàn)4星概率約94%
代碼如下:
Sub rand_card()
Dim rand_num As Long '隨機(jī)次數(shù)
Dim rand_rate As Long '隨機(jī)值
Dim rand_item(1 To 3) '隨機(jī)權(quán)重列表
Dim rand_ten_item(1 To 2) '十連保底權(quán)重
Dim rand_max, rand_max_guaranteed '最大權(quán)重?cái)?shù)
Dim rand_guaranteed_ten, rand_guaranteed_ninety '觸發(fā)保底次數(shù)
Dim cur_guaranteed_ninety '未出5星累計(jì)次數(shù)
Dim cru_guranteed_ten '未出4星累計(jì)次數(shù)
Dim rand_five_star_time, rand_four_star_time '出現(xiàn)的5星次數(shù),出現(xiàn)的4星次數(shù)
'=======基礎(chǔ)幾率==========
rand_item(1) = 60 '五星幾率
rand_item(2) = 570 '四星幾率
rand_item(3) = 10000 '其他幾率
'=======十連保底幾率======
rand_ten_item(1) = 60
rand_ten_item(2) = 1000
'====================
rand_guaranteed_ten = 10
rand_guaranteed_ninety = 90
cur_guaranteed_ninety = 0
cru_guranteed_ten = 0
rand_five_star_time = 0
rand_four_star_time = 0
rand_num = 100000
rand_max = rand_item(3)
rand_max_guaranteed = rand_ten_item(2)
For i = 1 To rand_num
'判斷未出5星的累計(jì)次數(shù)
'90次則觸發(fā)保底,次數(shù)清零,未達(dá)到90次,不觸發(fā)保底
'不觸發(fā)保底按照基礎(chǔ)幾率隨機(jī),出5星,次數(shù)清零,不出5星次數(shù)不清零
'判斷是否觸發(fā)10連保底,不觸發(fā),按照基礎(chǔ)幾率隨機(jī),觸發(fā),按照保底隨機(jī)
? ? If cur_guaranteed_ninety = 90 Then
? ? ? ? rand_five_star_time = rand_five_star_time + 1
? ? ? ? cur_guaranteed_ninety = 0
? ? ? ? 'cru_guranteed_ten = 0
? ? Else
? ? ? ? If cru_guranteed_ten >= 10 Then
? ? ? ? ? ? rand_rate = Int((rand_max_guaranteed * Rnd) + 1)
? ? ? ? ? ? If compara_rand(rand_rate, rand_ten_item) = 1 Then
? ? ? ? ? ? ? ?rand_five_star_time = rand_five_star_time + 1
? ? ? ? ? ? ? ?cur_guaranteed_ninety = 0
? ? ? ? ? ? ? ?'cru_guranteed_ten = 0
? ? ? ? ? ? Else
? ? ? ? ? ? ? ?rand_four_star_time = rand_four_star_time + 1
? ? ? ? ? ? ? ?cru_guranteed_ten = 0
? ? ? ? ? ? End If
? ? ? ? Else
? ? ? ? ? ? rand_rate = Int((rand_max * Rnd) + 1)
? ? ? ? ? ? Select Case compara_rand(rand_rate, rand_item)
? ? ? ? ? ? ? ? Case 1:
? ? ? ? ? ? ? ? ? ? rand_five_star_time = rand_five_star_time + 1
? ? ? ? ? ? ? ? ? ? cur_guaranteed_ninety = 0
? ? ? ? ? ? ? ? ? ? 'cru_guranteed_ten = 0
? ? ? ? ? ? ? ? Case 2:
? ? ? ? ? ? ? ? ? ? rand_four_star_time = rand_four_star_time + 1
? ? ? ? ? ? ? ? ? ? 'cru_guranteed_ten = 0
? ? ? ? ? ? ? ? Case 3:
? ? ? ? ? ? ? ? cur_guaranteed_ninety = cur_guaranteed_ninety + 1
? ? ? ? ? ? ? ? cru_guranteed_ten = cru_guranteed_ten + 1
? ? ? ? ? ? End Select
? ? ? ? End If
? ? End If
Next i
Debug.Print rand_five_star_time & "-" & rand_four_star_time
Debug.Print rand_five_star_time / rand_num & "-" & rand_four_star_time / rand_num
End Sub
'數(shù)值落區(qū)間
Function compara_rand(rand_num, rand_item) '當(dāng)前數(shù),數(shù)組
? ? For i = LBound(rand_item) To UBound(rand_item)
? ? ? ? If rand_num <= rand_item(i) Then
? ? ? ? ? ? compara_rand = i
? ? ? ? ? ? Exit For
? ? ? ? End If
? ? Next i
End Function

以下未計(jì)算出5星或者4星后重置情況。是錯(cuò)誤的。謝謝@aki-mine
