Last active
July 11, 2017 07:24
-
-
Save mokemokechicken/645954e7af05e88d54a88d877a7e389e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import seaborn as sns | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
from IPython.core.display import display | |
%matplotlib inline | |
N = 10 | |
M = 10 | |
def transfer_money(moneys): | |
to_moneys = np.random.randint(0, N, N) | |
for i in range(N): | |
if moneys[i] > 0: | |
moneys[i] -= 1 | |
moneys[to_moneys[i]] += 1 | |
moneys = np.ones((N, )) * M | |
for i in range(10001): | |
if i % 1000 == 0: | |
ax = sns.distplot(moneys, kde=False, bins=20) | |
ax.set_title("i=%d" % i) | |
ax.set_xlabel("money") | |
ax.set_ylabel("person count") | |
plt.show() | |
transfer_money(moneys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment