Since Basic is the most mentioned computer language here, I adapted the Roulette Simulation from TASC magazine to simulate a Pick3 Game. You should be able to use the source code below to experiment with other simulations. The code is simple because it merely outputs one number for each Trial (Person), leaving the graphics, if wanted, to Excel, or any other program you might prefer. I loaded it into Excel and produced a Histogram similar to those I scanned from the magazine above. The first picture is a pure bar chart based on the frequencies of Equity segments in the data.
If you're smiling at the crudeness and lack of good formatting and labels in this chart, then you are one of the people I'm hoping will give us some tips on how to better utilize Excel for charting!
This second graph is a screen capture describing the same data, but is using mean and standard calculations of the descriptive statistics module I have installed im my Excel. It's called Analyze-It. I've been told that newer versions of Excel can accomplish a lot of what it does, so this is just FWIW.
In this run, among other things, I found the following:
Of the 50,000 "People" who played for 13.7 years...
1012 Broke even (Ended up with their original $5000)
539 were ahead $500
240 were ahead $1000
37 were ahead $1500
6 were ahead $2000
4 were ahead $2500
I'll leave it up to you to calculate the fate of the rest!
The source code below tells you what this data means.
I don't have time now to discuss this, so I'll leave it for you to mull over for a while. What I'm hoping you will eventually be convinced that fair and purely random lotteries can result in people winning far above average expectations, even in Pick3s, WITH NO MORE THAN CHANCE to assist them!
Here's a link to the output of a run of the program below:
http://www.box.net/shared/sign4r88k3
Here's the source code of the Basic code. Basic is not my "Native" language, so please check it carefully.
'
' Simulation of a Pick-3 Lottery Game
'
' Adapted by Jimmy4164 from Phil Abel's
' Roulette Simulation in Casino Trading,
' TASC Magazine, November, 2003
'
' Assumes that 50,000 People each buy one $1 Straight
' ticket per day for 5000 Days, or about 13.7 Years.
' A Win pays $500.
DIM Equity AS LONG
DIM Person AS LONG
DIM DDraw AS INTEGER
DIM LP AS INTEGER ' Lottery's Pick
DIM QP AS INTEGER ' Player's QP
' Print results to an Excel file for further analysis
OPEN "PICK3.CSV" FOR OUTPUT AS #3
PRINT #3, "Equity"
RANDOMIZE 11 ' Try different seeds and observe results
FOR Person = 1 TO 50000 ' 50,000 "People"
Equity = 5000 ' $5000 Starting Equity
FOR DDraw = 1 TO 5000 ' Cycle through the Draws
' Buy a Ticket
QP = 100 * INT(RND * 10) + 10 * INT(RND * 10) + INT(RND * 10)
' Pay the Clerk!
Equity = Equity - 1
' Let the Balls Fly!
LP = 100 * INT(RND * 10) + 10 * INT(RND * 10) + INT(RND * 10)
IF QP = LP THEN Equity = Equity + 500
NEXT DDraw
' Write each Person's Equity to the file
PRINT #3, Equity ' $5000 - Costs + Winnings
IF Person MOD 500 = 0 THEN PRINT Person, Equity, QP, LP 'Halo?
NEXT Person
CLOSE #3 ' Close the file
END