Skip to content

Instantly share code, notes, and snippets.

@orico
Created July 8, 2019 09:43
Show Gist options
  • Save orico/0389c0fecb74a9d6e7a87ac45b28b1ec to your computer and use it in GitHub Desktop.
Save orico/0389c0fecb74a9d6e7a87ac45b28b1ec to your computer and use it in GitHub Desktop.
import numpy as np
rolls = 10000
n = 6
E = [0] * rolls
for i in range(0,rolls):
flag = False
ar = []
while flag == False:
rnum = np.random.randint(low=1, high=7, size=1)[0]
if rnum not in ar:
ar.append(rnum)
if len(ar)==6:
flag =True
E[i] +=1
# print(ar, E, len(E))
value = sum(E) / len(E)
print(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment