From 07cafbd6afb2aba531355f1ba35ee79176253f05 Mon Sep 17 00:00:00 2001 From: Karryanna Date: Tue, 9 Jun 2015 14:17:53 +0200 Subject: [PATCH] Labelling: Small fixes in rand* --- labeller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/labeller.c b/labeller.c index 309e209..7b24543 100644 --- a/labeller.c +++ b/labeller.c @@ -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: ; -- 2.39.2