• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Random 'Integer' performance

Status
Not open for further replies.
Level 9
Joined
Jul 30, 2018
Messages
445
If you want a 20% chance you have to make either "Random int between 1 and 10 is less than or equal to 2" or "Random int between 0 and 9 is less than 2".

It's easy to imagine like this: 10 should be 100% chance, therefor it has to be always true. And 0 is 0% chance, i.e. it has to always be false. "Random(1-10) <= 0" is always false and "Random(1-10) <= 10" is always true. "Random(1-10) < 10" Would be true only 90% of the time, because if the random number happened to be 10, it would not be less than 10.
 
Status
Not open for further replies.
Top