I'm interested in doing two (not completely) separate things in TikZ, if I should open another question for one part, please tell me so.

What I'm interested in is:

  1. Create a random array of filled shapes.
  2. Create a random shape.

and maybe combine the two, but that will be the next step. what I want is to define the shape limit (like 10pt, 20pt etc.) and not to determine it's path.


Here's what I got so far (can't answer my own question yet) , for instance:

\foreach \i in {4,8,...,16} {
\draw [fill=black,
        decoration={random steps,segment length=.5cm,amplitude=.5cm},
        rounded corners=.3cm]
     (\x,\x) -- (\x+3,\x) -- (\x+3,\x+3) -- (\x,\x+3) -- (\x,\x);

will result in


As you can see it's not really random but "ascending".

So, to narrow it down :

I would like the patterns to sit on random (or seemingly random) places, without intersecting each other.

Thanks in advance.

  • Is there any constraints on smoothness of the resulting shape path? And are you happy with your result above?
    – percusse
    Aug 28, 2013 at 20:23
  • no constraints, actually I got really close to what I wanted, so I'm going to edit the question.
    – Bitx
    Aug 28, 2013 at 21:13
  • 1
    Related Random ink blotches from tikz Aug 29, 2013 at 4:10
  • I think the related question is going to help me indeed. Man, I have to start using the search better :/
    – Bitx
    Aug 29, 2013 at 18:39

1 Answer 1


Since no constraints on smoothness of the result, I use pentagon for illustrations where I defined a macro (called \irregularshape) to draw a pentagon, whose vertices are determined randomly.


 \tikzstyle{every node}=[coordinate]
 \foreach \t/\x/\y in {1/18/1, 2/90/1.2, 3/162/1.4, 4/234/1.2, 5/306/1}
 {\pgfmathsetmacro\lenx{rnd*#1}   % seed
 \pgfmathsetmacro\leny{rnd*#2}    % seed
 \node(\t) at (\x+\lenx:\y+\leny) {};}                 
 \foreach \from/\to in {1/2, 2/3, 3/4, 4/5, 5/1}     
 {\draw [fill=black,rounded corners=1mm] (\from) -- (\to);}              

 %Parameters (#1,#2) are changeable, yielding vertices

 \irregularshape{1.4}{.3}&\irregularshape{.3}{2} \\
 \irregularshape{.3}{.4}&\irregularshape{2}{.3} \\

and an image is included. enter image description here

  • That's not really what I meant (the places of the shape has an orderly fashion about it), but I'm going to upvote it anyway because it gave me some insight for what I'm working on.
    – Bitx
    Aug 29, 2013 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .