Ejemplo n.º 1
0
 def _create_random_genes(self):
     new_genes = []
     for _ in range(self._length):
         new_genes.append(seeded_random.choice([True, False]))
     return new_genes
Ejemplo n.º 2
0
 def mutate(self, genes):
     if not self._is_mutating():
         return genes
     mutant = seeded_random.choice(range(len(genes)))
     genes[mutant] = not genes[mutant]
     return genes
Ejemplo n.º 3
0
 def _create_random_genes(self):
     new_genes = []
     for _ in range(self._length):
         new_genes.append(seeded_random.choice([True, False]))
     return new_genes
Ejemplo n.º 4
0
 def mutate(self, genes):
     if not self._is_mutating():
         return genes
     mutant = seeded_random.choice(range(len(genes)))
     genes[mutant] = not genes[mutant]
     return genes