Comments
This commit is contained in:
parent
a0785c17bc
commit
1c913d4b82
@ -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];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user