I could have written this for any lottery, really. But the Powerball is played across the entire country, and it's the one that everyone suddenly feels the need to play once the jackpot goes over $300M. Which makes sense, obviously. Because there is no point at all in playing if it's any lower than that. Pffft...
This simulator was written for my own curiousity and to make a point. The point being that the odds of winning are astronimical! The curiosity being, just how astronomical is that?
Someone can tell you, "The odds of hitting the jackpot are 1 in 175,223,510". But that number is utterly meaningless because it's so big. So, what were to happen if you played 175,223,510 times? Would you win even once?
I tried it, with this program. It takes a while. But it will return a result. Or it might crash your browser. I recommend keeping the number to a more reasonable level.
A MAJOR note about what I just wrote there. Those odds were 100% correct as of October 2015. I just realized that they changed the rules of the game. There are now 69 white balls, and 26 red. This means the odds of winning are actually: 1 in 292,201,338
Here is the formula, if you need to impress anyone: (69*68*67*66*65) / (5*4*3*2*1) * 26
The program here has been updated accordingly. I left the original set of odds on here so you can see what they did. They made the game more fun for everyone by making it WAY more difficult than it already was.
This is what the actual lottery website has to say about this... The overall odds of winning a prize are 1 in 24.87.
Why isn't the chance of winning $4 at 1 in 26? Click here for FAQ.