I found few random data generators for PostgreSQL (such as this one), but none supporting PostGIS geometry type, other than point. Making points would be quite easy, but for lines with multiple nodes and for polygons (I need more complex polygons than simple rectangles) it would be hell to write the function myself. I would prefer using others' tools (free and opensource, if possible) instead of making them myself.
EDIT: there are algorithms generating random points within a polygon. For polygons, I would prefer a different approach: to generate quasi-centroids first and then make polygons around them. I have some idea how to do it (random starting direction or random angle from previous node + random distance from quasi-centroid). Although if I found a tool generating polygons from scratch, making a centroid or a random point within would be easy. If no one points to any such a tool in a few days, I'll make it myself and post the code as an answer.
I don't need complex line generator so much now, so I'll either make it later, or wait for some other answers. Working complex line generators will get at least +1 from me even if I found I won't really need them, and if combined by some good complex polygon generation they should merit acceptation.