I used in for or while loop and this should be written correctly.
Here is the correct way to write randomly generated functions in C++:
srand(time(NULL));
while ( j < N ) {
std::array<int,Tsp::N> genes = {};
rand();
index = rand() % N;
if ( std::find(std::begin(genes), std::end(genes), index) == std::end(genes) ) {
genes[j]=index;
j++;
}
}
No comments:
Post a Comment