import random


def mutate(chromosome):
    """
    Pick a random bit to mutate by XOR and shifting the selected bit.  This
    ensures diversity in the population.
    """
    altered_bit_position = random.randint(0, 31)
    mutation = chromosome ^ (1 << altered_bit_position)
    return mutation