Now, one more, pretty obvious algorithm.
Create
N
points in same range, for example, the square on the points (0,0) and (1, 1), where
N
is a random number >= 3. For the obtained set of points, build a
convex hull. You can find some algorithm if you read this:
http://en.wikipedia.org/wiki/Convex_hull[
^].
Apparently, you would need one intermediate step: a convex hull may appear to be a set of points on the same straight line, or too close to some line. The trick is to detect this situation (if your convex hull algorithm not fails) and through out this solution, repeat the attempt.
—SA