def uniform_bin(parent1, parent2, bits):
    """Return a new chromosome using uniform crossover on a binary string.

    This is suitable for binary encoding.

    Args:
        parent1 (int): A parent chromosome.
        parent2 (int): A parent chromosome.
        bits (int): The number of bits used in the encoding.

    Returns:
        List[int]: Two new chromosomes descended from the given parents.
    """
    child1 = 0
    child2 = 0

    for locus in range(0, bits):
        mask = 2 ** locus
        child1 = mask & parent1 | child1
        child2 = mask & parent2 | child2
        parent1, parent2 = parent2, parent1

    return [child1, child2]