def mutate(self, p_mutate):
new_dna = []<EOL>for bit in self.dna:<EOL><INDENT>if random.random() < p_mutate:<EOL><INDENT>new_bit = bit<EOL>while new_bit == bit:<EOL><INDENT>new_bit = random.choice(self.GENETIC_MATERIAL_OPTIONS)<EOL><DEDENT>bit = new_bit<EOL><DEDENT>new_dna.append(bit)<EOL><DEDENT>self.dna = '<STR_LIT>'.join(new_dna)<EOL>
Simulate mutation against a probability.

p_mutate:  probability for mutation to occur