def mutate_value(element,parts,rel_amount=None):
    i = random.randint(0,len(element.values)-1)
    val = element.values[i]
    name = element.spice_name
    if rel_amount==None:
        try:
            val[i] = log_dist(parts[name]['value'][0],parts[name]['value'][1])
        except:
            return element
    else:
        try:
            temp = val[i]*(2*random.random-1)*rel_amount
            if parts[name]['value'][0]<=temp<=parts[name]['value'][1]:
                val[i] = temp
        except:
            return element
    try:
        cost = parts[element.spice_name]['cost']
    except __HOLE__:
        cost = 0
    return Device(element.spice_name,element.nodes,cost,val)
dataset/ETHPy150Open Ttl/evolutionary-circuits/evolutionary/chromosomes/netlist.py/mutate_value