title: What's a good way to generate random clusters and paths?
body: <p>I'm toying around with writing a random map generator, and am not quite sure how to randomly generate realistic landscapes. I'm working with <a href="http://www.d20pfsrd.com/gamemastering---final/environment---final/wilderness" rel="noreferrer">these sorts</a> of local-scale maps, which presents some interesting problems.</p>
  
  <p>One of the simplest cases is the <a href="http://www.d20pfsrd.com/gamemastering---final/environment---final/wilderness#TOC-Forest-Terrain" rel="noreferrer">forest</a>:</p>
  
  <pre><code>                    Sparse  Medium  Dense
  Typical trees       50%     70%     80%
  Massive trees       —       10%     20%
  Light undergrowth   50%     70%     50%
  Heavy undergrowth   —       20%     50%
  </code></pre>
  
  <p>Trees and undergrowth can exist in the same space, so an average sparse forest has 25% typical trees and light undergrowth, 25% typical trees, 25% light undergrowth, and 25% open space. Medium and dense forests will take a bit more thinking, but it's not where my problem lies either, as it's all evenly dispersed.</p>
  
  <p>My problem lies in generating clusters and paths, while keeping the percentage constraints. <a href="http://www.d20pfsrd.com/gamemastering---final/environment---final/wilderness#TOC-Marsh-Terrain" rel="noreferrer">Marshes</a> are a good example of this:</p>
  
  <pre><code>                    Moor  Swamp
  Shallow bog         20%   40%
  Deep bog            5%    20%
  Light undergrowth   30%   20%
  Heavy undergrowth   10%   20%
  </code></pre>
  
  <blockquote>
    <p>Deep bog squares are usually clustered together and surrounded by an irregular ring of shallow bog squares.</p>
  </blockquote>
  
  <p>An additional map element, a hedgerow, may also be present, as well as a path of open ground, snaking through the bog. Both of these types of map elements (clusters and paths) present problems, as the total composition of the map should contain X% of the element, but it's not evenly distributed. Other elements, such as streams, ponds, and quicksand need either a cluster or path-type generation as well.</p>
  
  <p>What technique can I use to generate realistic maps given these constraints?</p>
  
  <hr>
  
  <p>I'm using C#, FYI (but this isn't a C#-specific question.)</p>