**Check the revised version of this post.**

This is a function that I wrote to generate a random point inside a polygon. It works by first generating a random point within the bounding box of the polygon and then checking if the point falls inside of the polygon. The limit is 1000 iterations. This limit is probably enough for most practical cases with the exception for polygons that occupy only a small part of its bounding box. This is my first foray into PostgreSQL functions, please judge accordingly. I did not check how the function performs on the geometries other than polygons.