Tasting tea

In [1]:
import itertools as it
In [4]:
selects = list(it.combinations(range(8), 4))
In [5]:
len(selects)
Out[5]:
70
In [8]:
# Chance picking at random, uniform probability.
100.0 * (1.0 / 70.0)
Out[8]:
1.4285714285714286
In [9]:
import numpy as np
In [15]:
npselects = np.array(selects)
In [23]:
np.sum((npselects < 4).astype(int), axis=1)
Out[23]:
array([4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2,
       2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 3, 3, 3, 3, 2, 2, 2, 2, 2,
       2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
       1, 1, 1, 0])
In [ ]: