How do I generate this type of terrain randomly on runtime?

Hi there! does anyone know how I should go about creating similar terrain like in the first image and inverted so that the majority of the map stays flat except for the map edges (lead into ocean) and create rivers and lakes? Also how would I make it randomly generate per new game? I’m new to Unity so I’m not sure what to look up for specifics on this topic. Thank you for reading and hopefully enlighten me on this since it will greatly improve progress on my game.

First it would be easier if you would use a square plane, sure it would add some triangles but it would not change the visual aspect since the edges are meant to be underwater.

But in order to find the edge vertices, a polygon is more complex. In a plane, you would have to create a method iterating through the mesh and finding the vertices with min x, min y, max x and max y. If a vertex contains one of those, he is an edge vertex.

void Start(){
    Vector3[] edgeVertex = GetEdgeVertex();
    // Run your method to shape the plane
    // Discard action on the vertices containes in the list.
Vector3 []GetEdgeVertex()
    List<Vector3>list = new List<Vector3>();
    Mesh mesh = GetComponent<MeshFilter>().mesh;
    foreach(Vector3 v in mesh.vertices){
       // if the vertex is on the edge, add it to the list
       if(v.x == minX||v.x == maxX||v.z==minY||v.z==maxZ)
    return list.ToArray();

I am quite doing this by head so this may give you a lead but may not be fully working…