Comment

Comment by nonameiguess

I did run this many times by adapting the OP's own code (and vectorizing it, which he asked someone to do). Here it is:

    import numpy as np
    import pandas as pd
    
    n_subjects = 100
    n_trials = 1000
    start = 10.0
    win = 1.5
    loss = 0.6
    prob = 0.5
    
    results = np.ones((n_trials, n_subjects)) * start
    for trial in range(1, n_trials):
        wins = np.random.binomial(1, prob, n_subjects) == 1
        results[trial, wins] = results[trial - 1, wins] * win
        results[trial, ~wins] = results[trial - 1, ~wins] * loss
    ax = pd.DataFrame(results).plot(legend=False, figsize=(18,10), logy=True, linewidth=0.5)
    ax.plot(results.mean(axis=1), color='red', lw=2, linestyle='--')
The mean always trends to 0 and every single player eventually loses. There are never any winners at all past around 500 trials or so. Not sure how you're getting a different result as I have never used Julia and can't tell what your code is doing (except apparently something different).

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton