daily pastebin goal
73%
SHARE
TWEET

Randomizer

a guest May 17th, 2013 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. public class Randomizer {
  3.     static Random generator = new Random();
  4.     public static void main(String[] args) {
  5.         int a = 0, victory = 0, loss = 0, draw = 0;
  6.        
  7.         while (a < 100000) {
  8.             int myteam = 100, b = 0, c = 0, enemy = 0;
  9.             while (b < 14) {
  10.                 int rand = generator.nextInt(100) + 1;
  11.                 b++;
  12.                 myteam = myteam + rand;
  13.             }
  14.            
  15.             while (c < 15) {
  16.                 int rand = generator.nextInt(100) + 1;
  17.                 c++;
  18.                 enemy = enemy + rand;
  19.             }
  20.            
  21.             if (myteam > enemy) {
  22.                 victory++;
  23.             } else if (myteam < enemy) {
  24.                 loss++;
  25.             } else {
  26.                 draw++;
  27.             }
  28.             a++;
  29.             System.out.println("Times through: " + a);
  30.         }
  31.         System.out.println("Win: " + victory);
  32.         System.out.println("Loss: " + loss);
  33.         System.out.println("Draw: " + draw);
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top