Fractal heightmap using iterative midpoint displacement. Each iteration halves the step size and adds scaled random noise. The roughness exponent H controls how fast the noise decreases — H=1 is smooth, H=0 is rough. This produces terrain with fractal dimension D = 3-H.
Diamond step: each square's center gets average of 4 corners + noise. Square step: each diamond's center gets average of up to 4 diamond tips + noise. The Hurst exponent H links to fractal dimension: D = 3 − H.