Re: Actual Lottery Stuff. WOW eh?
- From: John Griffin <thathillbilly@xxxxxxxxxxx>
- Date: 31 Jul 2006 16:32:30 GMT
"Abraxas" <dontbother@xxxxxxxxxx> wrote:
"John Griffin" <thathillbilly@xxxxxxxxxxx> wrote in message
news:Xns981065F752F84thathillbillyyahooco@xxxxxxxxxxxxxx
"Abraxas" <dontbother@xxxxxxxxxx> wrote:
"Michael Harrington" <mikharr@xxxxxxxxxxx> wrote
"Abraxas" <dontbother@xxxxxxxxxx> wrote
"Michael Harrington" <mikharr@xxxxxxxxxxx> wrote
I thought that all sounded like lots of fun, so I wrote
a program which does the same thing using a different method.
It generates all the combinations serially and decides
whether to use each one by comparing a random number to the
proportion needed to fulfill the sample size in the remaining
ones. My machine is slower (2.7Ghz, I think), my program is
generalized to do any single-barrel game, and I run it in
the environment instead of making an executable, so maybe
that's why it takes longer to do 9,841,209 random lines
with a guarantee of no duplicates--
it takes 187 sec ....oops...you said minutes... never mind
that.
Right...everything has to be a competition for you...and you
always have to come out on top. Do you ever do anything
without having to boast about it?
I'm an ***, in case you forgot.
Why not compile the thing? I did. The .exe is only 28K and
runs a helluva lot faster. (Clue #1)
I never bother to compile any project because I almost always
have VB open and I never consider any program complete.
For the record, the compiled version completes the 9.8 million
lines in 113 sec. on my machine. That's a very impressive
87,090/sec. I like it!
Oddly enough, it takes 17 sec. to crank out just 1 million @
58,823/sec. Seems to pick up speed when it has more to do.
That's because of the fixed time it takes to generate all
possible combinations. It takes 22 seconds for a sample of size
zero on this machine (not compiled, as always here).
I have a suggestion. I believe a lot of time is wasted by
using the text file statements. (Not to mention those ugly
for..next things.) Creating a record with CR/LF and using
the put statement with a binary file gives the same result.
Here's the whole form file in case you care <yuk yuk>...
Ignore the thing that selects combinations by
generating a normally distributed variable, because it
isn't likely to work for a sample bigger than half the total.
Calls to function nextselection and the test of
its return value are commented out.
Why include things that should be ignored? (Clue #2)
That function was the original record selection method, and I
want to go back and see how it works for smaller samples. It
might be a dumb idea. The main reason it should be ignored is
that it calls itself under a certain condition, and I didn't
provide a way to be 100.00% certain it won't keep doing so until
a stack overflow occurs.
BTW, your code doesn't reset the variables when it finishes,
so if the user tries to run it more than once, it crashes with
a "subscript out of range" error. I'd like to see how you
would fix that.
That's weird! I knew I shouldn't have used those static variables
after I figured out that I couldn't make that function recursive.
I put a comment into it that tells how to fix it, if those are
what you're talking about. All other variables are local (on
the stack), so they're automatically destroyed upon exit from the
procedure.
I don't know why it says VERSION 5.00. I'm using VB6
in Visual Studio.
Heh-heh. (Clue #3)
I don't get it. Version 5.00 of what?
I just checked this out...every form file on this computer, 187
of them including the one I just now created to check this, has
that same first line, and they were all created with VB6.
Kudos John. You have earned my respect as a programmer...if in
fact it was you that actually wrote this very clever code. I
sincerely doubt that.
I wrote that Saturday night, except for the combination generator
and that "calc" function (95% of the program? heh heh), both of
which I wrote over a year ago...and I first wrote a version of
that trivial central limit thing for a simulation program in a
language called FAP on an IBM 7094, at about the time System/360
was first announced.
You have a penchant for calling everybody else in the world a
liar...
Liar.
no doubt because you yourself are a pathological liar
and therefore assume that everybody else must be as well. How
does it feel to be on the other end of that?
Watch your duck when you water him.
In any case...thanks for comin' out.
My pleasure.
.
- 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
- Re: Actual Lottery Stuff. WOW eh?
- From: Michael Harrington
- Re: Actual Lottery Stuff. WOW eh?
- From: Abraxas
- Re: Actual Lottery Stuff. WOW eh?
- From: John Griffin
- Re: Actual Lottery Stuff. WOW eh?
- From: Abraxas
- Actual Lottery Stuff. WOW eh?
- Prev by Date: Re: Hey Nick ?
- Next by Date: Re: A fool at LP tricks them
- Previous by thread: Re: Actual Lottery Stuff. WOW eh?
- Next by thread: Re: Actual Lottery Stuff. WOW eh?
- Index(es):