I am trying to run a simulation where ı have n balls and wants to put them in n boxes. I want to run the simulation 10.000 times and see how many boxes stayed empty in each time. For example in first simulation (1,1,1,1,0,3,0,2,1,0) I have 3 zeros. and at the and ı want to see how many times how many boxes stayed empty. Thats what I tried so far. Anyhelp would be appreciated. My code runs but it doesn't print the results. Also it doesn't loop either. I am using spyder IDE.
import itertools, operator
def combinations_with_replacement_counts(n, r):
size = n + r - 1
for indices in itertools.combinations(range(size), n):
starts = [0] + [index+1 for index in indices]
stops = indices + (size,)
yield tuple(map(operator.sub, stops, starts))
list(combinations_with_replacement_counts(10, 10))
a=combinations_with_replacement_counts(10, 10)
print (a)