I am reviewing a code which I believe runs based on probability. I would like to verify that if it is true. Does the following code snippet runs 80% of the time? I dont quite get why use 1000 then if our job is to merely run a code 80% of the time.
if(rand()%1000<1000*0.8){
...
}
Aucun commentaire:
Enregistrer un commentaire