[Tex/LaTex] Drawing random paths in TikZ

diagramspathstikz-pgf

I am looking for a way to draw with TikZ something that looks like a random path.

Here is an inspiration:

example

Is it possible to have TikZ generate something that would be similar to a random path instead of manually choosing points to connect together?

Thanks!

P.S. This question falls into a more general question (that does not necessarily needs to be answered): is there a (meta-)way to use TikZ to draw diagrams as they would appear on a chalkboard during a class. I mean TikZ generates very professional looking diagrams, but it's hard to draw a "random" curve just to express some notion, or draw a "random" diagram or "random" example to explain a notion.

Best Answer

This is an example taken directly from the pgf manual:

 \pgfmathsetseed{1}
 \foreach \col in {black,red,green,blue}
 {
   \begin{tikzpicture}[x=10pt,y=10pt,ultra thick,baseline,line cap=round]
     \coordinate (current point) at (0,0);
     \coordinate (old velocity) at (0,0);
     \coordinate (new velocity) at (rand,rand);
     \foreach \i in {0,1,...,100}
     {
       \draw[\col!\i] (current point) 
       .. controls ++([scale=-1]old velocity) and
                    ++(new velocity) .. ++(rand,rand)
          coordinate (current point);
       \coordinate (old velocity) at (new velocity);
       \coordinate (new velocity) at (rand,rand);
     }
   \end{tikzpicture}
 }

It is at the beginning of the Part VI: Mathematical and Object Oriented Engines. The whole section on mathematical engine is what you want to read if you want to do random drawing in tikz.