Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public static int playerCountFix(int playerCount) {
  2. Random r = new Random();
  3. int ran = r.nextInt(1); // Random 0 or 1
  4. int returnCount = playerCount; // Player count
  5. if(playerCount < 10) // Do nothing if the player count is below 10
  6. return returnCount;
  7. returnCount += (playerCount * 20 / 100); // Add 20% to the player count if its above 10
  8. if(playerCount > 20)
  9. returnCount += (playerCount * 15 / 100); // Add an additional 15% to the player count if its above 20
  10. if(playerCount > 30)
  11. returnCount += (playerCount * 10 / 100); // Add an additional 10% to the player count if its above 30
  12.  
  13. return returnCount + ran; // Return the "fixed" player count plus the random 0 or 1 so it isn't always even or odd
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement