Skip to content

Instantly share code, notes, and snippets.

@komly
Created September 25, 2015 16:00
Show Gist options
  • Select an option

  • Save komly/16d5d6ac4a12494c4124 to your computer and use it in GitHub Desktop.

Select an option

Save komly/16d5d6ac4a12494c4124 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import random
import matplotlib.pyplot as plt
initial = 100
def check(init, wage, n):
init = init
for i in range(n):
if init < 0:
break
init -= wage
coef = random.gauss(1.6, 0.5)
if random.randint(0, 1) == 1:
init = init + wage * coef
else:
wage = wage + 5
yield init
for i in range(1000):
stat = list(check(100, 5, 10000))
plt.plot(stat)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment