Re: Actual Lottery Stuff. WOW eh?




"Abraxas" <dontbother@xxxxxxxxxx> wrote in message
news:44ca3d56$0$30609$88260bb3@xxxxxxxxxxxxxxxxxxxx
"Michael Harrington" <mikharr@xxxxxxxxxxx> wrote in message
news:44c9d5e2$0$23677$5a62ac22@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Near as I can figger...there's no easy way to do that. Nobody said it
was
easy. Let me know when you've successfully generated 9.8 million unique
quick picks and I'll run them through my handy cipherin' sorter thingie
that
I keep handy for just such a purpose.


Here is a Visual Basic routine to generate as many unique quick
picks as you like. This prints the first 37 to screen but you can
do the whole lot if you have time. Let me know if you need a
routine to generate the actual tickets from their index number.
Cheers Mick.

Private Sub Command1_Click()
Dim Barrel(1 To 13983816) As Long, i As Long
Dim j As Long, pick As Long, drawn As Long

For i = 1 To 13983816
Barrel(i) = i
Next i

For j = 13983816 To 13983780 Step -1 ' we can lower this as desired
drawn = Int(Rnd * j) + 1
pick = Barrel(drawn)
Barrel(drawn) = Barrel(j)
Barrel(j) = pick
Print pick

Next j

End Sub



Thanks Michael. That's an interesting algorithm that I'll try out. I have
a
routine that will generate any desired quantity of random 6 number
combinations and save them to a text file. It's pretty quick at pumping
out
several thousand or even hundreds of thousands. I just don't have the
patience to wait for almost 10 million. Even on a fast machine, it takes a
considersble amount of time to reach even 1 million. Also, it inevitably
produces duplicate lines at some point and they're pretty difficult to
track
down. I've thought of using index numbers as you suggest, but it still
concerns me that duplicates would happen. There are ways to check for
duplicates, but that would slow the process to a crawl and render it
pretty
much impractical for such huge amounts of lines.

Thanks for your input.

Regards, Paul


This generates and stores 1,000,000 quick picks with
no duplicates. It then prints the first 30 to screen converting
index numbers into actual 6/49 lotto tickets. Takes about
6 seconds on my machine.

Private Sub Command1_Click()


Dim Barrel(1 To 13983816) As Long, i As Long
Dim j As Long, pick As Long, drawn As Long
Dim a As Long, b As Long, c As Long, d As Long
Dim e As Long, f As Long, iter As Long
Dim Chosen(1 To 13983816) As Boolean



For i = 1 To 13983816
Barrel(i) = i

Next i

For j = 13983816 To 1283816 Step -1 ' we can lower this as desired
drawn = Int(Rnd * j) + 1
pick = Barrel(drawn)
Barrel(drawn) = Barrel(j)
Barrel(j) = pick
Chosen(pick) = True
'Print pick

Next j

i = 0
For a = 1 To 44
For b = a + 1 To 45
For c = b + 1 To 46
For d = c + 1 To 47
For e = d + 1 To 48
For f = e + 1 To 49
i = i + 1
If Chosen(i) = True And iter < 30 Then
Print a, b, c, d, e, f
iter = iter + 1
End If

Next f, e, d, c, b, a

Print i 'check for 13983816

End Sub


.



Relevant Pages

  • Re: userform stopping duplication
    ... Dim ws As Worksheet ... > did you put all your assignments in the ELSE portion? ... > Private Sub cmdAdd_Click ... >> and also Duplicates ...
    (microsoft.public.excel.misc)
  • adding xml data to a combobox
    ... Private Sub Form1_Load(ByVal sender As Object, ... Dim objxmldoc As New Xml.XmlDataDocument ... I'm using this to load data into a combobox and it's working but my ... duplicates are being created in the combobox. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Modules not Known
    ... Dim pCode$ ... Dim pCodeModule As CodeModule ... Private Sub VBIDEReference() ... Option Compare Database ...
    (comp.databases.ms-access)
  • A VB6 program to generate CONSTants for a user defined gradient
    ... EndProperty ... It may be used for amy moral purpose. ... Dim mGreen1 As Long ... Private Sub ColorDisplay_MouseDown(Button As Integer, Shift As Integer, _ ...
    (comp.lang.basic.visual.misc)
  • Re: access 2003
    ... Dim ctl As Control ... Dim rs As Recordset ... This sets the query definitions for choosing data to create an invoice using ... Event on combo box: Private Sub ChooseCust_AfterUpdate ...
    (microsoft.public.access.conversion)