我正在编写一个应用程序,分析以前的彩票Powerball图纸,以增加获胜的几率。这就是我到目前为止所做的事情:
我从这样的文件中引入了完整的图纸: 06/29/2002 01 02 03 04 05强力球:01 我已经删除了数字,所以我可以遍历它们并用数字和数字绘制的次数填充数组。 我想抓住任何特定数字的抽取次数,数字,即数字1和44被抽出108次。我想将数据存储在这样的频率网格中,1,44 = 108(数字1和44被绘制108次)。这是我到目前为止的代码:
Private Class GetNumberFrequency
Public ReadOnly Property GetFrequencyGrid() As String
Get
'Get/Set Variables
Dim Size As Integer = CInt((Globals.UsersNumbers.Length /3))
Dim TempNumber As Integer = 0
Dim Frequency(59) As Integer
Dim Temp1 As Integer = 0
Dim SortedFrequency1(59) As Integer
Dim SortedFrequency2(59) As Integer
Dim Start As Integer = 0
For x As Integer = 0 To Size - 1 Step 1
TempNumber = CInt(Globals.UsersNumbers.Substring(Start, 3).TrimStart)
Frequency(TempNumber) += 1
Start += 3
Next
For i As Integer = 1 To Frequency.Length - 1 Step 1
Temp1 = Frequency(i) 'Get a number
For j As Integer = 1 To Frequency.Length - 1 Step 1
If Frequency(j) = Temp1 Then
'Here is where I am having the problem.
'I cant figure out the logic to use here.
'Right now the array holds the numbers and the number of times they
'were drawn,
'i.e. Frequency(1) = 108
Frequency(2) = 117
Frequency(3) = 106
Frequency(44) = 108
'I want to loop through the array values 108, 117, 106 and grab
'the indexes of each of these number draw frequencies (1, 2, 3, etc.),
'so I can display them as,
'Numbers Frequency
'1, 44 108
'7, 25 117, etc.
'I've tried using a 2 dimensional array but the array of Frequency(60, 60)
'creates an array of 3600 elements, and I don't need that many.
'I've also tried an array for the numbers and a string for the number of
'times drawn, but the logic escapes me.
'Any help will be appreciated! Thank you.
End If
Next
Next
Return Frequency.ToString
End Get
End Property
End Class