import random


def uniform_crossover(dna1, dna2):
    """randomly crossover genes between dna1 and dna2"""
    child1 = []
    child2 = []
    for ind in range(len(dna1)):
        p = random.random()
        if p < 0.5:
            child1.append(dna1[ind])
            child2.append(dna2[ind])
        else:
            child2.append(dna1[ind])
            child1.append(dna2[ind])
    return (child1, child2)