]> mj.ucw.cz Git - leo.git/commitdiff
Labelling: Some randint call fixes
authorKarryanna <karry@karryanna.cz>
Tue, 9 Jun 2015 11:06:09 +0000 (13:06 +0200)
committerKarryanna <karry@karryanna.cz>
Tue, 9 Jun 2015 11:06:09 +0000 (13:06 +0200)
randint(min, max) returns random number in range <min, max)

labeller.c

index ea962ae8ce31f22516b67daf1824270f42c10b3c..bfd67518a7c7a516807c0e1ff0e6557bef79ee0d 100644 (file)
@@ -1270,9 +1270,9 @@ struct individual **perform_crossover(struct individual *parent1, struct individ
         printf("Creating symbol closure for placement %u\n", i);
 
       struct placement **clos_symbols = get_closure(&(parent1->placements[i]));
-      int x = randint(1, 2);
+      int x = randint(0, 2);
 
-      if (x == 1)
+      if (x == 0)
       {
         if (dbg_breeding >= VERBOSITY_PLACEMENT)
           printf("Copying parent->child 1->1 and 2->2\n");
@@ -1310,7 +1310,7 @@ void mutate(void)
   {
     if (dbg_mutation >= VERBOSITY_INDIVIDUAL)
       printf("Creating %d-th individual by mutation\n", i);
-    int ind = randint(1, mutate_rbest_size);
+    int ind = randint(0, mutate_rbest_size);
     if (dbg_mutation >= VERBOSITY_INDIVIDUAL)
       printf("Mutating %d-th individual of original population\n", ind);
     population2[pop2_ind] = ep_alloc(ep_individuals);