I know Math.random() generates random numbers, my question is:
1.What is going on by comparing it to .5 (or 50%)?
2.How does that trigger the if statement into working?
3.Is Math.random() getting its numbers from the variable1?
variable1 = 8;
while (variable1 > 0){
If(Math.random() < .5){
variable1--;
}
}
Aucun commentaire:
Enregistrer un commentaire