def mutate(dna, dna_size, tune_params):
    """Mutate DNA with 1/mutation_chance chance"""
    dna_out = []
    mutation_chance = 10
    for i in range(dna_size):
        if int(random.random()*mutation_chance) == 1:
            dna_out.append(random_val(i, tune_params))
        else:
            dna_out.append(dna[i])
    return dna_out
Mutate DNA with 1/mutation_chance chance