def lst_random(lst, probs):
    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?
Return element[i] with probability probs[i].
dataset/ETHPy150Open Ttl/evolutionary-circuits/evolutionary/chromosomes/common.py/lst_random