SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         n = 4;
  2.         trees = new Tree[n][n];
  3.         int treeCount = 0;
  4.         Random rand = new Random();
  5.        
  6.         while(treeCount <= rand.nextInt(n*n/2)+n*n/2){
  7.             int i = rand.nextInt(n);
  8.             int j = rand.nextInt(n);
  9.             if(trees[i][j] == null){
  10.         if(rand.nextInt(2) == 0){  
  11.                     trees[i][j] = new Ash();
  12.                 }
  13.             else{
  14.                     trees[i][j] = new Beech();
  15.                 }
  16.                 treeCount++;
  17.             }
  18.         }
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