Randomly selecting points inside a triangle
SMRTR summary
Random points can be generated inside a triangle using three methods: barycentric coordinates (which doesn't produce uniform distribution), accept-reject (which discards points outside the triangle), or accept-flip (which uses a mirrored triangle to avoid waste). The accept-flip method efficiently creates uniform random points by keeping all generated points, sometimes after flipping them from a twin triangle back to the original.
SMRTR provides this summary for quick context. The original article belongs to Hacker News.
Read the original article