This is probably not a good way to generate a uniform mesh, because the separation of random points will have a large variance — some points will be very close together.

One simple procedure would be to generate a uniform cartesian (or hexagonal) grid and then truncate it to the shape of interest, but that may lead to “poor” triangles (closely spaced points) at the boundaries.

In-filling a general polygonal or polyhedral shape with a nearly uniform set of points (nearly equilateral triangles) is a tricky mathematical problem that is solved by various mesh-generation algorithms. I don’t know if there is a native Julia mesh-generation program yet, but there are Julia wrappers around various external libraries that can solve this problem, e.g. Gmsh.jl or TRIANGLE.jl.

(You can also call Matlab, or call Python packages like MeshPy … It would be nice if we had native Julia packages for everything right away, but we’ve worked hard on inter-language calling so that you can gradually transition: take advantage of mature libraries from other languages while still writing your problem-specific code in Julia.)

Instead of TRIANGLE.jl, consider also TriangleMesh.jl. They both wrap the same C library. TRIANGLE has a nicer API(?), but TriangleMesh wraps more methods. In particular, TRIANGLE only offers (Constrained) Delaunay Triangulation, but no mesh refinement.

This is probably not a good way to generate a uniform mesh, because the separation of random points will have a large variance — some points will be very close together.

Let’s say I’m stubborn and want to generate additional points anyway, to be used as the basis of a subsequent Delaunay triangulation. Would it be better to use some specific method of generating the points, e.g. using Sobol.jl, over just uniform sampling for each coordinate?