holybins wrote, On 5/27/2007 9:33 AM:
> I wrote a little ruby script that takes the mega millions drawing
> history from www.megamillions.com, and then makes a quickpick with the
> most picked numbers.
>
> It's not the most intelligent thing, so any advice on how to
> streamline the code and/or how to pick with a little more flexibility
> (I know all numbers have the same probability, but I know that some
> lotter systems use history data to improve chances...somehow), that
> would be awesome.
>   

I thought it would be interesting to see a graph of the data, so I 
modified the script to give me just the numbers/frequency drawn and made 
a chart.  There's nothing too interesting there (except that it reminded 
me the bigger numbers were added later), but I would change the script 
in a couple of ways:

1) Most importantly, if I remember correctly the numbers above 50 (was 
it 50?) were not added until some time after the first drawing.  I would 
dynamically figure out what percentage is missing and fill in that with 
frequency numbers for > 50.  Otherwise, you'll never be choosing those, 
even if they are relatively frequent (unless they are really frequent 
enough to catch up to the others).

2) Instead of just selecting the top numbers, I'd randomly choose 
numbers whose frequency appears in the top X percentile (perhaps not 
uniformly, but based on relative frequency - and even then you might 
make X larger)

3) I'd add the option to check only the most frequent drawings for some 
time scale (maybe limit the reporting/picking to choose based on numbers 
in the last year, for instance). 

4) I'd also cache the data file and only download it once per day (or 
week, or whatever) so you don't have to download it every time the 
program runs.

Cool stuff though.  =)

Sammy Larbi