Advertisement
Guest User

Untitled

a guest
Aug 8th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. // chance of tank, hitting the target
  2. int chance = 70;
  3.  
  4. // first, generate a pseudo random int
  5. int n = random();
  6.  
  7. // for percent, take the modulo of n with 100
  8. n = n % 100;
  9.  
  10. // if n is below chance, the tank will hit the target
  11. if(n < chance)
  12. {
  13. // do something here
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement