Skip to content

Instantly share code, notes, and snippets.

@cigrainger
Created February 16, 2015 15:03
Show Gist options
  • Save cigrainger/5e69783369ee7d7fe4b3 to your computer and use it in GitHub Desktop.
Save cigrainger/5e69783369ee7d7fe4b3 to your computer and use it in GitHub Desktop.
mcint
import numpy as np
from numpy import random
m = 1000
tot_n = np.zeros(m)
for i in list(range(m)):
n = 1
mcint = random.randn(n)
mean = str(np.mean(mcint)).split('.')
while mean[1][:3] != '000':
mcint = random.randn(n)
mean = str(np.mean(mcint)).split('.')
n += 1
tot_n[i] = n
avg_n = np.mean(tot_n)
print(avg_n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment