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];