Skip to content

Instantly share code, notes, and snippets.

@romanmichaelpaolucci
Created May 28, 2025 13:52
Show Gist options
  • Select an option

  • Save romanmichaelpaolucci/cf260599bca1cd25e68d9868b708ecf3 to your computer and use it in GitHub Desktop.

Select an option

Save romanmichaelpaolucci/cf260599bca1cd25e68d9868b708ecf3 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import numpy as np
payouts = []
for i in range(10000):
n = np.random.geometric(0.5)
payouts.append(2 ** n)
plt.title("Payout distribution")
plt.xlabel("Iterations")
plt.ylabel("Cumulative Mean")
plt.plot(np.cumsum(payouts) / np.arange(1, len(payouts) + 1))
plt.show()
print(np.mean(payouts))
print(np.std(payouts))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment