Lottery Simulator (2023)

205 pointsposted 10 months ago
by airstrike

104 Comments

shriracha

10 months ago

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).

BitwiseFool

10 months ago

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.

Retric

10 months ago

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

10 months ago

I did the same when I tried to create my own lottery. Thought the "correct" icons were the "wrong guess" ones and vice-versa

Vullun

10 months ago

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

10 months ago

>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

10 months ago

Can you track how many people have hit the jackpot? Or how long folks stuck around to see if they hit the jackpot?

Popeyes

10 months ago

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.

user

10 months ago

[deleted]

rerdavies

10 months ago

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.

SillyUsername

10 months ago

What probability distribution are you using for the random numbers?

twitexplore

10 months ago

I expected the "Winnings:" mouse-over on the frequency chart to tell me the total amount won on that $ category (count*single winning). On MS Edge it just shows "Count: 4033\nWinnings: $2"

tirant

10 months ago

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).

hakonslie

10 months ago

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 :'(

athorax

10 months ago

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.

futurabold

10 months ago

The site's newsletter module is broken. Won't accept my email.

is_true

10 months ago

wow, it's really good and the rest of your site is even better

zzanz

10 months ago

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

10 months ago

> 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

10 months ago

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

10 months ago

> 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

10 months ago

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

10 months ago

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

10 months ago

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.

user

10 months ago

[deleted]

jamie_ca

10 months ago

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

10 months ago

> > 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

10 months ago

> that reduces the payouts at the intermediate levels

Which has nothing to do with your chance of winning.

euroderf

10 months ago

But has something to do with the expected winning making it worth the investment.

gosub100

10 months ago

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.

user

10 months ago

[deleted]

moduspol

10 months ago

And now we also have the long-term effects of online sports betting to look forward to.

islewis

10 months ago

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

cataflam

10 months ago

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

10 months ago

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

10 months ago

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

10 months ago

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.

93po

10 months ago

this was my approach when i lived in oregon. i played the state lottery which was something like 20x better odds, granted the jackpot was usually like $6 million after cash out, but that was still totally good in my book. it cost a buck and i got to have fun with the idea of it for a few days.

one time i get like 20 weeks in a row up front (a post-dated ticket) and i won $56 dollars or something one week. i did the odds of that happened and it was something that would happen like once every 30 years if i played weekly. i stopped after that, haha.

serf

10 months ago

>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.

thephyber

10 months ago

> 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.

user

10 months ago

[deleted]

elseweather

10 months ago

In the US at least they're a state monopoly

gosub100

10 months ago

Because a lot of the proceeds go to school districts.

Aeolun

10 months ago

I think this lottery simulator is a scam. I played a hundred thousand games and never made my money back.

madamelic

10 months ago

You obviously haven't played enough. You stopped right before you hit it big!

frogpelt

10 months ago

You were due for a big win.

phs318u

10 months ago

You forgot the /s.

itake

10 months ago

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

GrantMoyer

10 months ago

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.

caseyy

10 months ago

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.

ff317

10 months ago

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

10 months ago

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

10 months ago

Dunno, seems wild to compare positive-but-still-unlikely ev things with straight up negative ev things like gambling.

avidiax

10 months ago

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

10 months ago

How many potato chip killers have there been?

How many lottery winners?

lupire

10 months ago

More people have died from toxic food than won the jackpot.

krisoft

10 months ago

> 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

10 months ago

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

BigParm

10 months ago

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

10 months ago

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

TheDong

10 months ago

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.

BizarroLand

10 months ago

I think the saying goes buying a lottery ticket only marginally increases your chance of winning.

r0fl

10 months ago

I like that logic

But does that mean you only buy 1 lottery ever in life or one each lottery?

itake

10 months ago

Just when the numbers get big :)

nine_k

10 months ago

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.

russellbeattie

10 months ago

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.

navark

10 months ago

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

10 months ago

Interesting. You got it at 11.6M tickets... I got it at 10,847,948.

rootusrootus

10 months ago

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.

gosub100

10 months ago

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.

kristopolous

10 months ago

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

10 months ago

I could never do that. Imagine the devastation of getting all of them right.

user

10 months ago

[deleted]

eig

10 months ago

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

10 months ago

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.

hellojesus

10 months ago

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

10 months ago

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)

jackcheng1126

10 months ago

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

10 months ago

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.

ldbooth

10 months ago

Very cool visualization. This will save me a few bucks next time I think about playing.

Idiot211

10 months ago

Any chance of multiple bonus numbers like the Euromillions offers?

touristtam

10 months ago

Yes I was interested to see how different the simulation would be.

mensetmanusman

10 months ago

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.

baggachipz

10 months ago

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."

efalcao

10 months ago

Hit a million dollar ticket! BRB going to buy lottery tickets!

PaywallBuster

10 months ago

Earnings $311,509,052 over 16,680,000 tickets

Average: $18.68 per ticket

thefoyer

10 months ago

This is exactly why I don't play the lottery

foragerdev

10 months ago

So, you will lose 1.84$ on each ticket you buy.

airstrike

10 months ago

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

10 months ago

No need to simulate. It is generally straightforward to compute the odds directly from the rules.

airstrike

10 months ago

For sure, but not as fun to watch!

jamesfinlayson

10 months ago

Australia's Saturday Lotto is one of the better ones I believe (1 in 6,000,000 or so I think).

user

10 months ago

[deleted]