title: Generate random map for tile world
body: <p>Platform game in C# / XNA.</p>
  
  <p>I have a <code>int[,]</code> array that I fill for example: </p>
  
  <pre><code>int[,] {
    {0, 0, 0, 1},
    {0, 0, 1, 2},
    {0, 1, 2, 2},
    {1, 2, 2, 2},
  }
  </code></pre>
  
  <p>Output:<br> </p>
  
  <pre><code>[air][air][air][grass]
  [air][air][grass][dirt]
  [air][grass][dirt][dirt]
  [grass][dirt][dirt][dirt]
  </code></pre>
  
  <p>Now I have a random function that fills the int array:<br></p>
  
  <pre><code>Random rnd = new Random();
  
  for (int i = 0; i &lt; 8; i++)
  {
    for (int x = 0; x &lt; 23; x++)
    {
       tiles[i, x] = rnd.Next(0, 3);
    }
  }
  </code></pre>
  
  <p>output:</p>
  
  <p><a href="https://i.stack.imgur.com/PrcD0.png&lt;br" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PrcD0.png&lt;br" alt="Platformer Example"></a></p>
  
  <p>What is a good algorithm to generate the map properly? Like above 45% more air and on top of dirt I want grass.</p>