Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // chance of tank, hitting the target
- int chance = 70;
- // first, generate a pseudo random int
- int n = random();
- // for percent, take the modulo of n with 100
- n = n % 100;
- // if n is below chance, the tank will hit the target
- if(n < chance)
- {
- // do something here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement