title: 2D Java Terrain Generator
body: <p>How can I form islands randomly in my 2D game? I have no idea how to start out!</p>
  
  <pre><code>void generateMap()
  {
      blocks.clear();
      for(int x = 0; x &lt; 150; x++)
      {
          for(int y = 0; y &lt; 150; y++)
          {
              if(Math.random() &lt; 0.5)
                  blocks.add(new Block(x * Block.blockSize, y * Block.blockSize, eBlockType.GRASS));
              else
                  blocks.add(new Block(x * Block.blockSize, y * Block.blockSize, eBlockType.WATER));
          }
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/0dLDg.png" alt="pic"></p>