def random( self ):
    """ each call -> a random int or key with the given probability
        fast: 1 randint(), 1 random.uniform(), table lookup
    """
    u = random.uniform( 0, 1 )
    j = random.randint( 0, self.n - 1 )  # or low bits of u
    randint = j if u <= self.prob[j] \
        else self.inx[j]
    return self.keys[randint] if self.keys \
        else randint
 each call -> a random int or key with the given probability
        fast: 1 randint(), 1 random.uniform(), table lookup
    
recipes/Python/576564_Walkers_alimethod_random_objects_different/recipe-576564.py