#!/usr/bin/python3
import random
#100 people start with $100
balances=[100]*100
#They take 10000 bets with an _expected_ return of 1.25x.
# ... so they should end up with ~1.2e1000 at the end...
for i in range(10000):
balances=[0 if x<=0 else random.choice([x*2,x//2]) for x in balances]
#Yet all or almost all are bankrupt:
print(len([x for x in balances if x<=0]))Who has ever claimed this? Also, people end up with zero because you are doing integer division in your code (ie the simplified expected return is wrong). Here are my results with 100 bets, and 10000 bet takers. The average return is also on the upward trend, but not really close since CLT doesn't really apply to this distribution:
>>> sum(balances)/1000000
24546192.840913434
>>> print(len([x for x in balances if x<=100]))
5426
>>> print(len([x for x in balances if x>=100]))
5381
>>> print(len([x for x in balances if x>100]))
4574You can show ruin without any flooring division:
#!/usr/bin/sage
import random
balances=[Rational(100)]*100
for i in range(10000):
balances=[0 if x<=0 else random.choice([x*2+2,x/2-1]) for x in balances]
#Yet all or almost all are bankrupt:
print(len([x for x in balances if x<=0]))
The key points are that there is a state that a participant can't recover from (e.g. ending up bankrupt) and you do enough trials that are reasonably likely to eventually wander into it.One that is the case 100 bets with 10000 betters and 10000 bets with 100 betters stop being the same thing.
And this is a very realistic and physical assumption because real investments have integerization, fees, overheads, etc. You can't invest a femto-cent in the market, and certainly not get the same relative returns as someone investing 100k.