Re: Actual Lottery Stuff. WOW eh?
- From: "Michael Harrington" <mikharr@xxxxxxxxxxx>
- Date: Sat, 29 Jul 2006 06:56:29 +1000
"Abraxas" <dontbother@xxxxxxxxxx> wrote in message
news:44ca3d56$0$30609$88260bb3@xxxxxxxxxxxxxxxxxxxx
"Michael Harrington" <mikharr@xxxxxxxxxxx> wrote in messageThis generates and stores 1,000,000 quick picks with
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
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
.
- Follow-Ups:
- Re: Actual Lottery Stuff. WOW eh?
- From: Abraxas
- Re: Actual Lottery Stuff. WOW eh?
- References:
- Actual Lottery Stuff. WOW eh?
- From: Abraxas
- Re: Actual Lottery Stuff. WOW eh?
- From: Gerry
- Re: Actual Lottery Stuff. WOW eh?
- From: Abraxas
- Re: Actual Lottery Stuff. WOW eh?
- From: Michael Harrington
- Re: Actual Lottery Stuff. WOW eh?
- From: Abraxas
- Actual Lottery Stuff. WOW eh?
- Prev by Date: Re: Baloney-filled Facts
- Next by Date: Re: Actual Lottery Stuff. WOW eh?
- Previous by thread: Re: Actual Lottery Stuff. WOW eh?
- Next by thread: Re: Actual Lottery Stuff. WOW eh?
- Index(es):
Relevant Pages
|