simple underscore.js projects, walk through, & tutorial
Lottery DataBase Analysis - 02
var oddsAgainst = [2400000,1200000,400000,12000,645,350,53,40,20,11,10];
var outputOne = oddsAgainst.length;
Nada Yet
function findOddsOfAnyPrize(rawOddsArray){
var culOdds = 0;
for (i = 0; i < rawOddsArray.length; i++){
culOdds += 1 / rawOddsArray[i];
}
return culOdds;
}
var outputTwo = findOddsOfAnyPrize(oddsAgainst);
Nada Yet
var outputThree = 1/outputTwo;
Nada Yet
This last compares quite favorable to the value found on the back of the lottery ticket:
"Odds of winning any prize 1:3.50; cash prize 1:5.38"
Of course, that last just begs the question, can I match the second value?
function findOddsCashPrize(rawOddsArray){
var culOdds = 0;
for (i = 0; i < rawOddsArray.length - 1; i++){ // which chops off the free ticket prize odds
culOdds += 1 / rawOddsArray[i];
}
return culOdds;
}
var outputFour = 1 / findOddsCashPrize(oddsAgainst);
Nada Yet
And the answer is NO.
So, take my calculations with a grain of salt.
Maybe it's rounding errors.
Maybe the lottery is wrong.
Or maybe, just maybe, I don't really know what I'm doing.
Yeah, my thoughts, as well. Folks at the lottery don't know their odds.
Oh, well. Happens to the best of us.
Please Note: I am an idiot. No seriously. The odds of my gambling
odds calculations being correct are likely on par with my odds of ever
winning. You have been warned.