Random Cave generation using terrain

I want to make a game about cave exploration but how do i make randomly generated cave systems using terrain? not parts but the roblox terrain system

Here is a post related to this.

It’s for parts, I know, but you can just reverse-engineer it to make it work for terrain.

Alternatively, a bit unrealistic method is to use bezier curves. Take 2 points, the start and end for a cave, and add more points that act a a control point. Then you can use code to sort of simulate a “worm” that eats up existing terrain.