How to Instantiate a prefab on the surface of a curved structure or mesh

I’m making a game where a ball is rolling along a curved surface, like a ‘u’ shape or a halfpipe. I want to instantiate a “Hole” prefab that the ball can fall into on the surface of the structure. How would I make the holes instantiate at a random point on the structure or mesh? I was thinking about using raycasting, but I’m not very good at that. Any ideas?

You could select a random vertex from the mesh’s vertex array (an array of 3d points)

int index=Random.Range(0,mesh.vertices.count);
Vector3 someRandomlySelectedVertexPosition= mesh.vertices[index];

These vector3’s are in local space,so you may need to transform them to world space, depending on how you child your instantiated object.

Vector3 instancePos=transform.TransformPoint(someRandomlySelectedVertexPosition);

Then instantiate

Instantiate(pitPrefab, instancePos, mesh.normal[index]); //hmm for rotation, you could probably use the meshs normal for that vertex! try it? edit: I think this would need to be transformed too, at least it's orientation.