dimanche 29 novembre 2015

[C++]Finding error about the pointer of a distribution (function)

Could someone tell me what is wrong about my code (C++):

int main(){
unsigned seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
std::subtract_with_carry_engine<unsigned, 24, 10, 24> gen(seed);
std::tr1::normal_distribution<double> *imDensity;
imDensity = new std::tr1::normal_distribution<double>(0, 5);

double p = imDensity(gen) //here is the error
}

The error is "expression preceding parentheses of apparent call must have (pointer-to-) function type". I have to pass the random generator to the distribution function, but I don't know how to do it when using a pointer.




Aucun commentaire:

Enregistrer un commentaire