It works fine:
srand(time(NULL)); cout<<(double)rand()/RAND_MAX<<endl;
It doesn't work:
srand(time(NULL)); cout<<static_cast<double>(rand()/RAND_MAX)<<endl;
Why? How to fix it?
Aucun commentaire:
Enregistrer un commentaire