Home Lottery Odds Quotes Funnies Buffy Geocaching Shopping Links |
I recently decided to teach myself some JavaScript, and after reading up on it and wading through some tutorials, I realised that the best way to learn would be to set myself a "real" project to work through. Since I enter quite a few online lotteries, and having often wondered what the odds of winning various prizes might be, I decided to do a lottery calculator. Not only could it be done in JavaScript, it also gave me an opportunity to brush up on my maths. It's amazing just how much the human brain is actually capable of forgetting - I was horrified at how difficult it was to get my head round what were probably some relatively simple probability calculations! Anyway, after quite a bit of thinking, scribbling and finally coding, I eventually came up with something that worked, and as I was rather inexplicably proud of my achievement, I decided to post it up here for the world to see (be gentle, it is my first attempt at this!) If you enter the number of balls available, the number that are actually drawn and the number you want correct, the form will calculate the odds of getting that combination eg to calculate the odds of winning ten quid in the UK National Lottery you would enter 49 balls, 6 drawn and 3 correct - try it, see what you think! Spurred on by this unexpected success I decided it would also be useful to have a way of generating random numbers for a lottery competition, cos for some reason I never quite trust the random suggestions made by the various lottery sites themselves - I expect they are actually genuine, but you can never be sure, so I decided to do my own: | ||||