Simple header-only random point generator over 3D surfaces.
GLM is the graphics math library used (only dependency used), but the code is easily changed to use others such as Eigen.
The point distribution is uniform, that is, it doesn't rely solely on vertex positions and has no face size biases (points aren't, however, evenly spaced in this implementation). Face size bias is removed by sampling a triangle, picking a random index from a cumulative face area array.
A point P is generated using the following formula:
β and α are random numbers. The square root of β sets the percentage from vertex A to the opposing edge, while α represents the percentage along that edge. Taking the square-root of β gives a uniform random point with respect to surface area.
Reference:
Bernard Chazelle David Dobkin Robert Osada, Thomas Funkhouser. Shape Distributions. ACM Transactions on Graphics, 2002.