I am writing an app that analyzes previous lottery Powerball drawings to increase the odds of winning. Here's what I have done so far:
I've brought in the complete drawings from a file like this: 06/29/2002 01 02 03 04 05 Powerball: 01 I've cut out the numbers, so I can loop through them and fill an array with the numbers and the number of times that number has been drawn. I would like to grab the number of times any particular number was drawn, and the number, i.e. the numbers 1 and 44 were drawn 108 times. I want to store the data in a frequency grid like this, 1, 44 = 108 (the number 1 and 44 were drawn 108 times). Here's the code I have so far for this:
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
Step 1is redundant as it is the default step.