There are a lot of mathematics behind a lot of seemingly simple procedural generation - from minecraft terrains to texture maps and wang tiles

https://en.m.wikipedia.org/wiki/Wang_tile