Re: Actual Lottery Stuff. WOW eh?



"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?

Why not compile the thing? I did. The .exe is only 28K and runs a helluva
lot faster. (Clue #1)

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.

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)

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.

I don't know why it says VERSION 5.00. I'm using VB6
in Visual Studio.


Heh-heh. (Clue #3)

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.

You have a penchant for calling everybody else in the world a 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?

In any case...thanks for comin' out.





--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages