lundi 5 juin 2017

How do I calculate the percent chance from using Int(Rnd()) in VB.NET?

If Int(Rnd() * 5) >= 4

The line of code above is supposed to give a 40% chance of something happening. However, I do not understand how this 40% is calculated. Would Int(Rnd()*2.5) = 1 also give 40%?

I would very much appreciate if someone could explain how calculate percentages using this function.




Aucun commentaire:

Enregistrer un commentaire