title: Smoothing issue with Diamond-Square algorithm
body: <p>I am using the diamond-square algorithm to generate random terrain.
  It works fine except I get these large cone shapes either sticking out of or into the terrain.
  The problem seems to be that every now and then a point gets set either way too high or way too low.</p>
  
  <p>Here is a picture of the problem<br>
  <img src="https://i200.photobucket.com/albums/aa143/kronikel/m1.jpg" alt="screenshot"></p>
  
  <p>And it can be better seen when I set the smoothness really high<br>
  <img src="https://i200.photobucket.com/albums/aa143/kronikel/m2.jpg" alt="screenshot closeup"></p>
  
  <p>And here is my code -</p>
  
  <pre><code>private void CreateHeights()
      {
          if (cbUseLand.Checked == false) 
              return;
          int
              Size = Convert.ToInt32(System.Math.Pow(2, int.Parse(tbDetail.Text)) + 1),
              SideLength = Size - 1,
              d = 1025 / (Size - 1),
              HalfSide;
          Heights = new Point3D[Size, Size];
          float
              r = float.Parse(tbHeight.Text),
              Roughness = float.Parse(RoughnessBox.Text);
  
          //seeding all the points
          for (int x = 0; x &lt; Size; x++)
              for (int y = 0; y &lt; Size; y++)
                  Heights[x, y] = Make3DPoint(x * d, 740, y * d);
  
          while (SideLength &gt;= 2)
          {
              HalfSide = SideLength / 2;
  
              for (int x = 0; x &lt; Size - 1; x = x + SideLength)
              {
                  for (int y = 0; y &lt; Size - 1; y = y + SideLength)
                  {
                      Heights[x + HalfSide, y + HalfSide].y =
                        (Heights[x, y].y +
                        Heights[x + SideLength, y].y +
                        Heights[x, y + SideLength].y +
                        Heights[x + SideLength, y + SideLength].y) / 4 - r + ((float)(random.NextDouble() * r) * 2);
                  }
              }
  
              for (int x = 0; x &lt; Size - 1; x = x + SideLength)
              {
                  for (int y = 0; y &lt; Size - 1; y = y + SideLength)
                  {
                      if (y != 0)
                          Heights[x + HalfSide, y].y = (Heights[x, y].y + Heights[x + SideLength, y].y + Heights[x + HalfSide, y + HalfSide].y + Heights[x + HalfSide, y - HalfSide].y) / 4 - r + ((float)(random.NextDouble() * r) * 2); 
                      if (x != 0)
                          Heights[x, y + HalfSide].y = (Heights[x, y].y + Heights[x, y + SideLength].y + Heights[x + HalfSide, y + HalfSide].y + Heights[x - HalfSide, y + HalfSide].y) / 4 - r + ((float)(random.NextDouble() * r) * 2);
                  }
              }
              SideLength = SideLength / 2;
              r = r / Roughness;
          }
      }
  </code></pre>