]> mj.ucw.cz Git - leo.git/commitdiff
Labelling: Small fixes in rand*
authorKarryanna <karry@karryanna.cz>
Tue, 9 Jun 2015 12:17:53 +0000 (14:17 +0200)
committerKarryanna <karry@karryanna.cz>
Tue, 9 Jun 2015 12:17:53 +0000 (14:17 +0200)
labeller.c

index 309e209adb1591ee2b061530ce8ce866d0acf3f1..7b2454315126cfdf6e970b970f45a68ebf58fed6 100644 (file)
@@ -1306,8 +1306,8 @@ struct individual **perform_crossover(struct individual *parent1, struct individ
 
   if (conf_mutate_children)
   {
-    if (randint(1, 1000) < conf_mutate_children_prob * 1000) perform_mutation(child1);
-    if (randint(1, 1000) < conf_mutate_children_prob * 1000) perform_mutation(child2);
+    if (randdouble() < conf_mutate_children_prob) perform_mutation(child1);
+    if (randdouble() < conf_mutate_children_prob) perform_mutation(child2);
   }
 
   buffer[0] = child1;
@@ -1365,10 +1365,10 @@ void perform_mutation(struct individual *individual)
         case REQUEST_SEGMENT:
         case REQUEST_AREA:
           // Does nothing when there are 0 variants... does it mind?
-          p->variant_used = randint(0, GARY_SIZE(p->request->variants) - 1);
+          p->variant_used = randint(-1, GARY_SIZE(p->request->variants));
           break;
         case REQUEST_SECTION:
-          p->variant_used = randint(0, GARY_SIZE(((struct request_section *) p->request)->segments)-1);
+          p->variant_used = randint(0, GARY_SIZE(((struct request_section *) p->request)->segments));
           break;
         default:
           ;