How to randomly generate some points and place them on the pyramid surface?

At present, I am using random form to draw some point cloud figures. At present, I have successfully realized the drawing of circles and cubes. They look like this:

But when I try to draw a pyramid, I can’t find a reasonable way to randomly generate points on the surface.

I think I need some advice or ideas.

Have you considered to use MeshSurfaceSampler? Using a generic approach should make it easier to work with many different types of geometries.


Thank you! Amazing!
It’s much simpler than I thought, but it’s frustrating because I can’t understand how it works…