Is there any other way to generate random shapes ?
Another way would be kick off a dot to crawl across the plane which turns randomly but with a general preference for turning right. So eventually it'd cross its own tail like the snake game. Various tweakable parameters there to get different kinds of shapes.
Or tile a plane with some shape, either regular or e.g. voronoi tiles or something, then start with one tile and flood-fill a random number of tiles out from that based on some randomized way of selecting the next tile to fill. Actually I guess you could do that with just the pixels as a square "tiling" too and skip a step.
Or capture an image from the device's camera, posterize it somehow and pick out an edge. That's real-world input so arguably truly random, but maybe would always be a thumb shape.
What's the application? Do they have to look like something in particular? Clouds or caves or something?
The issue that frightens me with the dot is that, moving randomly would lean towards oscillating movements or so i predict, and never ever result in a shape that you would get by asking the first stranger you meet to draw a shape.
I might try something like flood fill and use pixels.
I do not have a camera but if i had the issue would be what if the input is almost the same from each generaton ?
The application, originally was to create a random leaf shape based on a seed ( integer).
And with the plane implementation suggested by
Archive, you still run into an issue that it is not complete.
Source: my implementation
In
blue the segments that are considered edges.
In
black all my segments are drawn.
In
red, the points the algorithm build the shape from. These points are based on the
blue segments.
So what i shall consider to select a segment as an edge ?