Landscape.generateLandscape C# (CSharp) Method

generateLandscape() private static method

private static generateLandscape ( int height ) : IEnumerable
height int
return IEnumerable
    private static IEnumerable<int> generateLandscape(int height)
    {
        var r = new Random();

        int y = height / 2;

        for (int x = 0; ; x++)
        {
          yield return y;

          // difference from previous y
          y += (int)(r.Next(-5, 6) ^ 4 / 400);

          // floor and ceiling
          y = Math.Max(0, Math.Min(height, y));
        }
    }