def _make_index(prob, size):
 rv = np.random.uniform(size=(size, 1))
 cumprob = np.cumsum(prob)
 return np.logical_and((np.r_[(0, cumprob[:(-1)])] <= rv), (rv < cumprob))

def _make_index ( prob , size ) : rv = np . random . uniform ( size = ( size , 1 ) ) cumprob = np . cumsum ( prob ) return np . logical_and ( ( np . r_ [ ( 0 , cumprob [ : ( - 1 ) ] ) ] <= rv ) , ( rv < cumprob ) )
returns a boolean index for given probabilities .