[HN Gopher] Lottery Simulator (2023)
       ___________________________________________________________________
        
       Lottery Simulator (2023)
        
       Author : airstrike
       Score  : 193 points
       Date   : 2024-09-10 21:09 UTC (1 days ago)
        
 (HTM) web link (perthirtysix.com)
 (TXT) w3m dump (perthirtysix.com)
        
       | airstrike wrote:
       | Now I just need to scrape the data on all major lotteries
       | worldwide, plop them all into the simulator, make some
       | assumptions about exchange rates and figure out where in the
       | world I should bet on the lottery to get the best payout!
        
         | ISL wrote:
         | No need to simulate. It is generally straightforward to compute
         | the odds directly from the rules.
        
           | airstrike wrote:
           | For sure, but not as fun to watch!
        
         | jamesfinlayson wrote:
         | Australia's Saturday Lotto is one of the better ones I believe
         | (1 in 6,000,000 or so I think).
        
       | itake wrote:
       | the expected value of each ticket is negative, but going from 0
       | tickets to 1 ticket, increases your chances of a big win by
       | infinity.
       | 
       | Going from 1 to n tickets, isn't necessarily wise
        
         | caseyy wrote:
         | Estimated monetary value might be a wiser metric to use :)
         | 
         | Going by the calculator, EMV of going from buying 0 tickets to
         | 1 is -$1.85 for Mega Millions, same as going from n to n+1; n
         | >= 0. The first ticket is the first one you lose with,
         | statistically.
        
         | BizarroLand wrote:
         | I think the saying goes buying a lottery ticket only marginally
         | increases your chance of winning.
        
         | BigParm wrote:
         | Your chances were 0, you buy a ticket, and now your chances are
         | x. Where x is not infinitely greater than 0, it's x greater
         | than 0. Pretty sure your proposition implies that 2 tickets
         | provide the same odds as one ticket (2 infinity vs 1 infinity).
         | 
         | I haven't gotten into the discrete math in many years. If
         | you're right do you mind explaining please? I can intuit what
         | you're getting at. 0 odds * inf < (odds with one ticket). Is
         | that a decent description?
        
           | web007 wrote:
           | Odds for N tickets as odd(N):
           | 
           | odd(0) = 0
           | 
           | odd(1) = X, so odd(1) / odd(0) = +Inf increase in odds of
           | winning vs 0
           | 
           | odd(2) = 2X, so odd(2) / odd(1) = 2x increase in odds of
           | winning vs 1
        
         | ff317 wrote:
         | That's kind of how I look at it, in practice. I get the
         | mathematical reality that buying lotto tickets is a financial
         | waste. However, if I never buy a single ticket, there is a
         | definite 0% chance I'll ever win the big prize. Whereas if I
         | play at all, at least there's a chance, however remote, of a
         | quite life-changing positive event happening. So, therefore, it
         | makes sense to put a very small amount of totally throw-away
         | income into big-prize lotto tickets, just so you're in the game
         | at all.
         | 
         | Based on this kind of thinking, my personal rules are: never
         | spend more than 0.1% of take-home pay per time-period buying
         | tickets, and only buy big-prize lotto tickets that have
         | potentially-life-changing payouts.
        
           | seagullriffic wrote:
           | This is almost exactly how I think about it too - a good
           | repeatable mental model is "infinite upside / near-zero
           | downside".
           | 
           | These massively asymmetric choices occur elsewhere in life,
           | e.g. "asking them out on a date"; "asking for a raise", and
           | are good to look out for.
        
             | cwillu wrote:
             | Dunno, seems wild to compare positive-but-still-unlikely ev
             | things with straight up negative ev things like gambling.
        
           | avidiax wrote:
           | There's a near-zero possibility that the next potato chip in
           | the bag has been laced with cyanide. But if you never eat any
           | potato chips, there's a definite 0% chance that you'll die of
           | cyanide-laced potato chips.
           | 
           | This kind of thinking never holds up when it's a small chance
           | of a horrible outcome.
        
             | ryanjshaw wrote:
             | How many potato chip killers have there been?
             | 
             | How many lottery winners?
        
           | krisoft wrote:
           | > However, if I never buy a single ticket, there is a
           | definite 0% chance I'll ever win the big prize.
           | 
           | I'm not sure about that. There is some chance of someone
           | random buying a ticket and gifting it to you and then that
           | ticket winning. Not a big chance. But it is not 0.
        
         | petesergeant wrote:
         | In the real world, there's a non-zero chance that someone
         | purchased a ticket on your behalf without you knowing, so
         | you're never quite at 0
        
         | GrantMoyer wrote:
         | On the other hand, if I don't buy a lottery ticket, I have no
         | chance to waste my money on the lottery, but if I do buy a
         | ticket, the odds of wasting money are infinitely higher.
        
         | nine_k wrote:
         | To believe that you take a chance and you suddenly get the
         | prize, despite statistics, is to believe that you're special.
         | Maybe some people try such things to return the warm feeling of
         | the early pre-school years.
        
         | TheDong wrote:
         | This is nonsense if it's meant to be interpreted as anything
         | but a joke, or as a way to maximize your own personal fun.
         | 
         | If you send me $20k of bitcoin and a UUID, I will run
         | 'crypto.randomUUID()', and if I get the same UUID as you I'll
         | send back $40k.
         | 
         | If you don't send me any money, you have 0% chance of winning,
         | but if you do send me $20k, you have a mere 1 in 2^122 chance
         | of winning, an infinite increase in your chance of winning, so
         | surely it is rational to do so.
         | 
         | If you truly believe what you just wrote, I'll await my $20k.
        
       | ldbooth wrote:
       | Very cool visualization. This will save me a few bucks next time
       | I think about playing.
        
       | Aeolun wrote:
       | I think this lottery simulator is a scam. I played a hundred
       | thousand games and never made my money back.
        
         | madamelic wrote:
         | You obviously haven't played enough. You stopped right before
         | you hit it big!
        
         | frogpelt wrote:
         | You were due for a big win.
        
         | phs318u wrote:
         | You forgot the /s.
        
       | zzanz wrote:
       | I used to work at a lotto counter in my towns supermarket. When I
       | started I noticed alot of older regular buyers, a weekly lotto
       | purchase like the daily newspaper. However, as the younger
       | generation started bringing in kids I didn't see this habit,
       | instead just an occasional purchase for a birthday gift or
       | rolling the dice because the jackpots gotten big enough (funnily
       | enough the time when the chance of winning is actually lowest).
       | 
       | Overall I would consider lotto small next to the scratch cards
       | (our countries version at least). I have never seen a more
       | predatory marketing strategy, and completely swept under the rug
       | next to lotto being berated with anti-gambling campaigning. To be
       | fair, lotto is bad, but scratch cards are much, much worse.
       | 
       | A memory that stuck for me was a customer blowing well over $100
       | bucks on scratchcards over 20 minutes, just pulling over and
       | over, then getting card declined at the grocery checkouts.
        
         | IncreasePosts wrote:
         | > funnily enough the time when the chance of winning is
         | actually lowest
         | 
         | Not really?
         | 
         | The odds of winning are the same regardless, because you need
         | to match every number to get a jackpot. Really, there is just
         | an increased chance of splitting a jackpot with another person
         | when the prize gets really large, since more tickets are
         | generally sold. But I imagine EV of a lottery ticket with a $1B
         | jackpot is still higher than the same lottery ticket when the
         | jackpot is $100M.
        
           | function_seven wrote:
           | There's a balance between jackpot size and a given drawing's
           | popularity for sure.
           | 
           | There are also bad number choices and good number choices.
           | 1,2,3,4,5,6 is a _terrible_ selection, for example. Not
           | because it is somehow "less random", but because you're
           | guaranteed to be splitting that jackpot with a 1,000 other
           | nerds who were trying to prove a point!
           | 
           | To a lesser degree, choosing numbers under 31, or under 12,
           | will put you in a collision space with other players who like
           | to choose birthdays.
           | 
           | Just use the random pick and don't think about it. If you do
           | win the jackpot, you have higher odds of being the only one.
        
             | RulerOf wrote:
             | > 1,2,3,4,5,6 is a terrible selection, for example. Not
             | because it is somehow "less random", but because you're
             | guaranteed to be splitting that jackpot with a 1,000 other
             | nerds who were trying to prove a point!
             | 
             | Uh... so at first I saw your point, but if your odds of
             | winning never actually change, how is not winning better
             | than splitting a jackpot?
        
               | function_seven wrote:
               | I guess if you only play one drawing, you're right.
               | Winning is always better than losing.
               | 
               | But if you play the lottery week after week, year after
               | year--and you always play the same numbers--then you're
               | ensuring a mediocre prize should you actually get the
               | jackpot.
               | 
               | Playing the lottery is not a mathematically sound
               | decision in any case, but there's no reason to make it
               | even worse by chopping your potential jackpot winnings
               | down by over 99%
        
               | bongodongobob wrote:
               | The odds of winning don't change, the odds of splitting
               | the pot change. Certain numbers are picked more than
               | others so to have the best odds of not splitting the pot,
               | random numbers are best.
        
               | rerdavies wrote:
               | Numbers greater that 31 are better. Almost 30% better!
               | Because you are less likely to split a pot when you win.
               | But not good enough to make playing a lottery ticket a
               | winning propostition.
        
           | jamie_ca wrote:
           | Maybe, "the time when expected value is the lowest"?
           | 
           | The BC 6/49 lottery (6 balls 1-49, one bonus ball) for
           | example has 53% of the common "prize pool" split amongst all
           | 4-ball matchers, so if you're not hitting the jackpot you get
           | less cash out of a high-demand drawing.
           | 
           | And given the prize pool is something like 18% of net
           | receipts... yeah EV is still well in the negatives.
        
           | euroderf wrote:
           | > > funnily enough the time when the chance of winning is
           | actually lowest
           | 
           | > Not really?
           | 
           | A big jackpot draws more players, and that reduces the
           | payouts at the intermediate levels.
        
             | krisoft wrote:
             | > that reduces the payouts at the intermediate levels
             | 
             | Which has nothing to do with your chance of winning.
        
               | euroderf wrote:
               | But has something to do with the expected winning making
               | it worth the investment.
        
             | gosub100 wrote:
             | What do you mean by intermediate levels? In the 2 main US
             | lotteries the only award that gets split is the single
             | jackpot. Even the 2nd place award is $1 million and is not
             | divided among multiple winners.
        
         | moduspol wrote:
         | And now we also have the long-term effects of online sports
         | betting to look forward to.
        
       | eig wrote:
       | Cool visualization!
       | 
       | It would've been nice to not assume only one lottery winner.
       | People tend to pick numbers that are meaningful for them:
       | birthdays, favorite numbers, lucky numbers. Thus it actually
       | significantly increases your EV if you pick unusual numbers,
       | which is not reflected here.
        
         | hammock wrote:
         | So, for Mega Millions:
         | 
         | For 1-70: Consider numbers above 31 (days of month)
         | 
         | For 1-25: Similarly, numbers above 12 might be less common
         | (months of year)
         | 
         | What other numbers above 31 would you want to avoid? 33, 44,
         | 50, 69, 70? And you might want to avoid sequences as well.
        
       | shriracha wrote:
       | Hi! I made this tool. I saw it had way more traffic than usual
       | and then realized it was from HN, very cool!
       | 
       | Would love to hear any feedback. I've been super interested in
       | how well-designed web apps and visualizations can communicate
       | things like probability, which I think is very hard to intuit for
       | many of us.
       | 
       | The most surprising thing I learned from the tool was just how
       | bad your payouts usually were even if you cut the pool of numbers
       | to pick from in half (by using the "Custom" option).
        
         | is_true wrote:
         | wow, it's really good and the rest of your site is even better
        
         | BitwiseFool wrote:
         | I would very much like to see an even faster "turbo" option
         | because even though the current max speed of 1,000 tickets a
         | second really drives home the point of how long it would take
         | to actually win, I still want to see the simulation hit the
         | jackpot a few times.
        
         | Vullun wrote:
         | I noticed that when you select pick random numbers, it only
         | picks it once. Can we run the simulation where it picks new
         | numbers every time? I would love to see if that would make an
         | impact on the odds.
        
           | sfilmeyer wrote:
           | >I would love to see if that would make an impact on the
           | odds.
           | 
           | It won't make an impact on the odds of your tickets coming up
           | as winners, unless they have a bug in their simulation. In
           | the real world the probability of single versus multiple
           | jackpot winners might vary with number choices, but they've
           | already said they're assuming a single jackpot winner.
        
         | earle_wa wrote:
         | Can you track how many people have hit the jackpot? Or how long
         | folks stuck around to see if they hit the jackpot?
        
         | Retric wrote:
         | Reading people's replies it seems like many are
         | misunderstanding the expected value of a ticket. You may want
         | to add another column to the table of odds showing what
         | percentage a ticket's hypothetical payout is from each prize,
         | or just what the average loss per ticket is.
         | 
         | Also, at one point I messed up which pattern on Mega Millions
         | tickets were winners. Something about that big X in a separate
         | column just subconsciously seemed like it was showing winners.
         | Perhaps dashes vs checks or groupings winning and non winning
         | tickets together.
        
           | airstrike wrote:
           | I did the same when I tried to create my own lottery. Thought
           | the "correct" icons were the "wrong guess" ones and vice-
           | versa
        
         | tirant wrote:
         | Custom option needs more options: some big lotteries use two
         | extra numbers (e.g. Euromillions). Other lotteries just pick up
         | a single number from 00000 to 99999 (or even lower).
        
         | SillyUsername wrote:
         | What probability distribution are you using for the random
         | numbers?
        
         | Popeyes wrote:
         | Really good tool, I made a very basic text one and showed a few
         | friends and it put them off the lottery.
         | 
         | One suggestion I would make is allowing the random numbers
         | selected by the user to be random for each draw. I understand
         | in the scheme of things that it doesn't make difference to your
         | odds but that's a strategy that some people play.
         | 
         | It would also be cool to track how many other people chose the
         | same numbers that you did and then divide the jackpot winnings
         | by that amount of people.
         | 
         | Another thing (I'm really just giving you a todo list of things
         | that I had) was to organise the number selectors to mirror the
         | pattern on the lottery tickets. People have very different
         | approaches, picking columns, going over 31, sequences and you
         | could track the user behaviour behind number selection.
        
         | hakonslie wrote:
         | I never use Lotteries, but I was curious and wanted to test a
         | domestic one, however the bonus number can be from 1 to 5, but
         | I cant put it lower than 10 on your page :'(
        
         | rerdavies wrote:
         | Select random numbers greater than 31, and run them against
         | past winning numbers, using the actual prize pool payouts
         | (histories available for all major lotteries). Repeat millions
         | of times. You'll be amazed how much more money you win. ;-P
         | (And how much money you still lose even with this impressive
         | advantage).Unfortunately, there aren't enough historical draws
         | to determine whether there are more fine-grained statistically-
         | significant differences. My tests were actually run on first-
         | half vs. last half. But > 31 seems like a defensible rule as
         | well.
        
         | athorax wrote:
         | It might just be me, but it took me awhile to even realize
         | there were interactive components on the page. Something about
         | it made it seem like they were screenshots.
        
       | fragmede wrote:
       | On the subject of winning the lottery, the story that goes untold
       | is of the MIT crew that gamed Massachusetts' Cash Windfall circa
       | 2007.
       | 
       | https://www.theatlantic.com/business/archive/2016/02/how-mit...
       | 
       | There's a movie out starring Walter White, of the Selbees side,
       | called Jerry and Marge Go Large, but which talks about the story,
       | but portrays the MIT kids poorly for dramatic effect.
        
         | fsckboy wrote:
         | https://archive.is/G5Ctz
        
       | islewis wrote:
       | Can someone explain to me how the EV can be so incredibly low? I
       | know the answer is because people will buy the tickets no matter
       | what, but even compared to other losing games the lottery comes
       | away looking like an absolute bandit.
       | 
       | A run on the simulation (n=1000000) comes back with -92% EV. It
       | looks like -10% [1] is a rough estimate for slot machine EV,
       | which I would ballpark into the same game genre (-EV, no skill
       | entertainment) as the lottery.
       | 
       | What accounts for this payout discrepancy in what I would
       | consider similar games? On that train of thought, what prevents a
       | new lottery from coming in and offering a _generous_ -50%
       | lottery, offering ~5x as much money as before?
       | 
       | [1]* https://www.888casino.com/blog/expected-value
        
         | elseweather wrote:
         | In the US at least they're a state monopoly
        
         | serf wrote:
         | >On that train of thought, what prevents a new lottery from
         | coming in and offering a _generous_ -50% lottery, offering ~5x
         | as much money as before?
         | 
         | federal-level gambling syndicate isn't something that a private
         | party can easily jump into.
         | 
         | so the answer is : a mix of 'grandfather'd-in' and
         | protectionism, if we're talking U.S. here.
        
         | cataflam wrote:
         | Because you shouldn't use the simulator to calculate the EV, or
         | said differently your n=1000000 is too small.
         | 
         | Assuming you used the first lottery example (Mega Millions),
         | the EV is easy to calculate directly and is -$0.66/ticket, ie
         | -33%
         | 
         | The jackpot is a whole $1 of that EV! Without it, the EV is
         | -$1.75/ticket, ie -87%, which is closer to what you got in the
         | simulation.
        
           | thephyber wrote:
           | Exactly.
           | 
           | In short, the simulator doesn't buy enough ticket-draws to
           | approach the Law of Large Numbers.
           | 
           | But that's also a feature of the lottery -- most people
           | overestimate their ability to win or underestimate how many
           | lifetimes of consistent play is required to statistically win
           | a jackpot.
        
             | onion2k wrote:
             | I don't think people actually make that mistake. They know
             | the chance of winning is tiny. The point is more that a
             | non-zero chance of life changing money (plus the
             | entertainment of fantasising about a win) is worth more to
             | them than the cost of the ticket.
        
               | gamepsys wrote:
               | Exactly, winning the lottery is massively life changing.
               | This is actually something I think people don't
               | understand about the psychology of lottery. In some
               | regards it doesn't matter if the money is $50M or $500M
               | for most players even though that has a huge impact on
               | the EV.
        
         | thephyber wrote:
         | > What accounts for this payout discrepancy
         | 
         | Mega lotteries draw once every 2-8 days. Slot machines / video
         | poker / etc are happy to draw as fast as you can push the
         | button. They are designed to take your money, but their rewards
         | systems are completely different.
         | 
         | Also, the mega lotteries benefit from viral marketing, "earned
         | media", and water cooler talk. Slot machines are just a way for
         | bored people to pass the time, much like video games or
         | doomscrolling.
        
         | gosub100 wrote:
         | Because a lot of the proceeds go to school districts.
        
       | hellojesus wrote:
       | Does this have any way of simulating multiple plays per draw? I'm
       | curious what happens to EV when you buy X tickets per draw
       | instead of just 1. And for both circumstances: (a) ensure all X
       | tickets are unique and (b) random entries with replacement.
        
         | ISL wrote:
         | Unless you're buying a meaningful fraction of tickets, the
         | EV/ticket will be similar to uncorrelated tickets.
         | 
         | If you're buying all the tickets, well, the math is real easy.
         | (and occasionally profitable, see 1992 in Virginia)
        
       | russellbeattie wrote:
       | Humans are so weird... No matter how simple you make a slot
       | machine, for some reason it's still compelling to play.
       | 
       | On one of my runs, I won $1 million which put my numbers in the
       | green for a while before slowly going into the red again.
       | 
       | That's going to legitimately brighten the rest of my day.
        
       | tomthe wrote:
       | HN user ggerganov made a similar tool with real historical
       | numbers from Bulgaria:
       | 
       | https://lottery-check.ggerganov.com/
        
       | rootusrootus wrote:
       | I got lucky. Won a million bucks early in the simulation and it
       | took a while before the EV was negative again. Should have
       | stopped right after winning a million, duh.
        
       | hidelooktropic wrote:
       | Looks a lot like https://www.adamgrant.info/heres-1m-dollars-try-
       | to-win-the-l...
        
       | kristopolous wrote:
       | For years whenever I see lottery numbers announced I first scrawl
       | some guesses on a piece of paper, trying to summon all divine
       | power I can muster.
       | 
       | I think I once guessed 2 of them . This way I get all the thrill
       | of the game with none of the cost.
        
         | KeplerBoy wrote:
         | I could never do that. Imagine the devastation of getting all
         | of them right.
        
       | hitthejackpot wrote:
       | Won the mega millions after about 1.1 million tickets. EV per
       | ticket is now >$200. I think I'm taking the wrong lesson from
       | this - time to get gamblin'
       | 
       | Screenshot: https://ibb.co/6mm3hqh
        
       | efalcao wrote:
       | Hit a million dollar ticket! BRB going to buy lottery tickets!
        
       | jackcheng1126 wrote:
       | The tool has a maximum speed of 1000 tickets per second, which
       | may not be fast enough for some users. Hopefully the author will
       | consider adding a 'turbo' option to make the simulation faster so
       | we can get more results in less time.
        
       | dostick wrote:
       | What would be super interesting is to collect all different
       | lotteries from different countries and regions, and run
       | simulations to find which ones are most lucrative. And you can't
       | treat know how good is your local lottery in comparison.
        
         | camjohnson26 wrote:
         | There was a Romanian economist who was able to exploit several
         | lotteries around the world. He essentially bought every
         | combination to lotteries where the payout was higher than the
         | cost. Logistical nightmare.
         | 
         | https://thehustle.co/the-man-who-won-the-lottery-14-times
        
       | foragerdev wrote:
       | So, you will lose 1.84$ on each ticket you buy.
        
       | mensetmanusman wrote:
       | Can we add quantum suicide to this simulation?
       | 
       | This is where you entangle your mortal soul to the lottery
       | outcome and are only allowed to survive if you win.
       | 
       | This is a cheat code for the parallel universe crowd.
        
       | PaywallBuster wrote:
       | Earnings $311,509,052 over 16,680,000 tickets
       | 
       | Average: $18.68 per ticket
        
       | baggachipz wrote:
       | I'm the smarmy prick who, when somebody says they bought a
       | lottery ticket, I say "Give me the same amount you paid for that
       | lottery ticket, and if you win I'll double your winnings."
       | 
       | Them: "there's no way you could afford to pay me!"
       | 
       | Me: "I won't have to."
        
       | gosub100 wrote:
       | Not sure if anyone linked it here, but my favorite simulator was
       | a 2D grid, with about 50 or so units per side. The computer picks
       | 3 squares, you pick 3 squares. The XxY unit grid was set up such
       | that if you picked the same 3 squares as the computer, it was the
       | same odds as winning Powerball. Seeing how hard it was to even
       | get 1 square really drove home the odds. I also did a similar
       | calculation by estimating the area of millions of quarters
       | (enough to represent the 1/N chance to win) and thought "ok, if I
       | launched a rubber ball randomly at high velocity in this huge
       | room, I would win if it landed on one exact quarter that I picked
       | in advance. When I saw it like that, I realized there's no way.
        
       | navark wrote:
       | I won! That's it, the lottery is worth playing if only I can
       | repeat this performance IRL.
       | 
       | I won the $340,000,000 Powerball Grand Prize after buying
       | 11,651,310 $2 tickets leaving me with a grand total of
       | $319,781,766 in earnings ($27.45 per ticket).
        
         | FireBeyond wrote:
         | Interesting. You got it at 11.6M tickets... I got it at
         | 10,847,948.
        
       | thefoyer wrote:
       | This is exactly why I don't play the lottery
        
       | Idiot211 wrote:
       | Any chance of multiple bonus numbers like the Euromillions
       | offers?
        
         | touristtam wrote:
         | Yes I was interested to see how different the simulation would
         | be.
        
       ___________________________________________________________________
       (page generated 2024-09-11 23:02 UTC)