@@ 1367-1375 (lines=9) @@ | ||
1364 | $PreviousValue = 1; |
|
1365 | $Done = False; |
|
1366 | $k = $m + 1; |
|
1367 | while ((!$Done) && ($k <= $trials)) { |
|
1368 | $CurrentValue = $PreviousValue * ($trials - $k + 1) * $probability / ($k * (1 - $probability)); |
|
1369 | $TotalUnscaledProbability += $CurrentValue; |
|
1370 | if ($k == $Guess) { $UnscaledPGuess += $CurrentValue; } |
|
1371 | if ($k <= $Guess) { $UnscaledCumPGuess += $CurrentValue; } |
|
1372 | if ($CurrentValue <= $EssentiallyZero) { $Done = True; } |
|
1373 | $PreviousValue = $CurrentValue; |
|
1374 | ++$k; |
|
1375 | } |
|
1376 | ||
1377 | $PreviousValue = 1; |
|
1378 | $Done = False; |
|
@@ 1380-1388 (lines=9) @@ | ||
1377 | $PreviousValue = 1; |
|
1378 | $Done = False; |
|
1379 | $k = $m - 1; |
|
1380 | while ((!$Done) && ($k >= 0)) { |
|
1381 | $CurrentValue = $PreviousValue * $k + 1 * (1 - $probability) / (($trials - $k) * $probability); |
|
1382 | $TotalUnscaledProbability += $CurrentValue; |
|
1383 | if ($k == $Guess) { $UnscaledPGuess += $CurrentValue; } |
|
1384 | if ($k <= $Guess) { $UnscaledCumPGuess += $CurrentValue; } |
|
1385 | if ($CurrentValue <= $EssentiallyZero) { $Done = True; } |
|
1386 | $PreviousValue = $CurrentValue; |
|
1387 | --$k; |
|
1388 | } |
|
1389 | ||
1390 | $PGuess = $UnscaledPGuess / $TotalUnscaledProbability; |
|
1391 | $CumPGuess = $UnscaledCumPGuess / $TotalUnscaledProbability; |