From 1c913d4b827e41f481ba210f118bddc4b77298a6 Mon Sep 17 00:00:00 2001 From: zenon Date: Thu, 31 May 2018 15:00:57 +0200 Subject: [PATCH] Comments --- generator.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generator.c b/generator.c index 1800402..1b13d1d 100644 --- a/generator.c +++ b/generator.c @@ -195,10 +195,13 @@ void genSolution(int permutation[]) { int r; + // initialize array to indices for (int i = 0; i < graph.V; i++) { permutation[i] = i; } + // loop from end to start, choose random and switch + // with number at current index. for (int i = (graph.V - 1); i > 0; i--) { r = rand() % (i+1); int tmp = permutation[r];