samedi 3 août 2019

Random function is not recognized in file and states that term does not evaluate to a function taking 0 arguments

I am trying to use a random number generator for some code in C++. The project has multiple headers/source files and while the rand() function works fine in some files, I am getting the following error in only one file: "expression preceding parentheses of apparent call must have (pointer-to-) function type" as well as term does not evaluate to a function taking 0 arguments.

I have already tried to utilize numerous header files to see if the file can recognize my code, including math, stdlib, random, and time header files.

for(int i = 0; i < this->populationSize; i++){
   int id1 = rand() * this->neighborhoodSize;
   int id2 = rand() * this->neighborhoodSize;
while(id1 == id2){
   id2 = rand() * this->neighborhoodSize; 
}




Aucun commentaire:

Enregistrer un commentaire