Last active
May 8, 2021 12:00
-
-
Save telliott99/7a28b357e171a677f6d86c455c771799 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
from matplotlib import pyplot as plt | |
import random | |
N = 10000 | |
n = 100 | |
L = list() | |
tL = list() | |
v = 0 | |
for i in range(N): | |
r = random.random() | |
v += r | |
if v >= 1.0: | |
v -= 1.0 | |
L.append(int(n*r)) | |
tL.append(int(n*v)) | |
plt.hist(L,n,alpha=0.5,color='r') | |
plt.hist(tL,n,alpha=0.5,color='b') | |
plt.savefig('example.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment