# Breakeven Bet: Expected Value and Simulation

Here is the problem:

• A bet is known to have a win rate of 25%.
• Upon winning, the bet pays $100. • Player can choose the cost of the bet. My understanding is that the breakeven bet size would be 25% times \$100 = $25, equal to the expected value of each bet. However, I simulated this game with a short Python script: The simulation results in a profit, even after 100 million trials. It seems to always result in a profit, I've ran the simulation many times. It appears that ~$33 is closer to the actual breakeven bet size (not shown, I just manually adjusted the bet size higher until the resulting profit converged to about zero).

What am I missing here? Am I calculating the breakeven bet size wrong or is there something wrong with the simulation?

• It can help to make the code look as much like the problem description as possible. At the head of the loop, then, subtract the cost of the bet from total_value (you will want to create a constant cost_of_bet = 25 to do this clearly) to model the cost of the bet. Upon success, add win_value to total_value to model the gain from winning. You don't have to do anything when success does not occur! BTW, why do you usenp.random.normal? That's obscure and inefficient compared to np.random.ranf. – whuber Aug 19 '17 at 20:21
• @whuber Thanks for the useful feedback. I don't have a really good reason for using np.random.normal. I found it here and thought it made sense to specify the distribution from which the randoms were being created (I compared the distributions here) – Joseph Dasenbrock Aug 20 '17 at 13:55