def lst_random(lst, probs):
    """Return element[i] with probability probs[i]."""
    s = sum(probs)
    r = random.uniform(0,s)
    t = 0
    for i in xrange(len(lst)):
        t += probs[i]
        if r <= t:
            return lst[i]
    return lst[-1]#Because of rounding errors or something?
dataset/ETHPy150Open Ttl/evolutionary-circuits/evolutionary/chromosomes/common.py/lst_random/original