public static void Render(ArrayGrid2D<double> grid, CornerData corners, double range, double h, Random random,
out double min, out double max)
{
if (grid.Width != grid.Height)
throw new Exception();
var ctx = new Context()
{
Random = random,
Grid = grid,
Corners = corners,
Range = range,
H = h,
Min = Math.Min(Math.Min(Math.Min(corners.SW, corners.SE), corners.NE), corners.NW),
Max = Math.Max(Math.Max(Math.Max(corners.SW, corners.SE), corners.NE), corners.NW),
};
grid[0, 0] = corners.SW;
grid[grid.Width - 1, 0] = corners.SE;
grid[grid.Width - 1, grid.Height - 1] = corners.NE;
grid[0, grid.Height - 1] = corners.NW;
HeightMap(ctx);
min = ctx.Min;
max = ctx.Max;
}