Terrain generation requires making random noise that is continuous. Three terrain generation algorithms, midpoint displacement, diamond-square, and perlin noise.
The source code: https://github.com/mathkimchi/Terrain-Generation
For more videos like this, visit https://www.mathkimchi.org/