Games of chance are dependent on the odds. The odds are determined based on how many times a number appears in a given range. The better understanding of the odds that we have, the more educated our guesses can be.
I am not a mathematician, but one of the tools I developed while feeling my way through this was something that would calculate the odds of a number appearing based on the position and previous number. Here is a sample of the results that it produced.
The code I use to calculate these number looks like this:
Public Sub Build_Odds_Table(ByVal Base As Byte, ByVal Digits As Byte, LeadN0 As Byte, LastPos As Byte)
If LastPos < Digits Then
m_tblOdds.Clear()
Dim RemainingBase As Byte = Base - LeadN0
Dim RemainingDigits As Byte = Digits - LastPos
Dim NU As New clNumUtilities
Dim BaseFreq As Long = 1
BaseFreq = NU.Calc_Permutations(RemainingBase, RemainingDigits)
Dim TargetPos As Byte = LastPos + 1
Dim TargetRemainingDigits As Byte = RemainingDigits - 1
For N0 = LeadN0 + 1 To Base - (TargetRemainingDigits)
Dim NR As dsOddsCalculator.tblOddsRow = m_tblOdds.NewRow
NR.Pos = TargetPos
NR.LeadN0 = LeadN0
NR.N0 = N0
NR.BaseFreq = BaseFreq
NR.Freq = NU.Calc_Permutations(Base - N0, TargetRemainingDigits)
NR.HitPercent = NR.Freq / BaseFreq
m_tblOdds.AddtblOddsRow(NR)
Next
Dim Sorted() As dsOddsCalculator.tblOddsRow = m_tblOdds.Select("Pos = " & TargetPos & " and LeadN0 = " & LeadN0, "Freq Desc, N0")
Dim Ranking As Byte = 0
Dim RunningPercent As Double = 0
Dim LastBase5 As Byte = 0
Dim LastBase10 As Byte = 0
Dim Base5Seq As Byte = 0
Dim Base10Seq As Byte = 0
For Each RW In Sorted
RunningPercent += RW.HitPercent
RW.RunningPercent = RunningPercent
Ranking += 1
RW.Ranking = Ranking
RW.RunningBase5 = NU.Get_BaseNNumRoot(NU.RoundDown(RunningPercent * 100, 1), 5)
If RW.RunningBase5 <> LastBase5 Then Base5Seq += 1
RW.RunningBase5SeqNo = Base5Seq
LastBase5 = RW.RunningBase5
RW.RunningBase10 = NU.Get_BaseNNumRoot(NU.RoundDown(RunningPercent * 100, 1), 10)
If RW.RunningBase10 <> LastBase10 Then Base10Seq += 1
RW.RunningBase10SeqNo = Base10Seq
LastBase10 = RW.RunningBase10
Next
End If
m_tblOdds.AcceptChanges()
End Sub
The routine that I use to calculate permutations is:
Public Function Calc_Permutations(ByVal Base As Integer, ByVal Digits As Integer) As Long
m_Base = Base
m_Digits = Digits
Dim BaseSum As Double = 1
Dim DigitsSum As Double = 1
For DC = 0 To Digits - 1
BaseSum = BaseSum * (Base - DC)
DigitsSum = DigitsSum * (Digits - DC)
Next
m_TotalCombos = BaseSum / DigitsSum
Return m_TotalCombos
End Function
The data table referred to in the routine looks like this: