# Persistent random steps decorations during beamer \uncover

I'm using a random steps decoration with a path that appears through several uncover transitions. Currently the decoration is redrawn in each instance of the slide. How can I change this behavior. A minimal example follows. Thanks.

\documentclass[presentation]{beamer}
\usepackage{tikz, pgf}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{frame}
\begin{center}
\begin{tikzpicture}
\uncover<1-3>{
\fill [decorate, decoration={random steps,segment length=2pt,amplitude=2pt}] (0,0) ellipse (0.5cm and 0.4cm);
}
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}

-
I think this should be more mentioned in tutorials since it's really necessary whenever you have to deal with randomly generated graphics. It's often the case that you need to repeat a drawing multiple times with slight differences and there's no simple way to generate the data and store it, all from latex. –  facuq Nov 28 '13 at 21:14

You can set the random seed each time you draw the ellipse, like so:

\documentclass[presentation]{beamer}
\usepackage{tikz, pgf}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}

\begin{frame}
\begin{center}
\begin{tikzpicture}
\uncover<1-3>{
\pgfmathsetseed{1234} % Choose a four-digit number here
\fill [decorate, decoration={random steps,segment length=2pt,amplitude=2pt}] (0,0) ellipse (0.5cm and 0.4cm);
}
\end{tikzpicture}
\end{center}
\end{frame}

\end{document}


The best part is that \pgfmathsetseed is local so outside this tikzpicture environment the pseudo-random number generator will behave as usual.

And by the way random.org is a cool place to get random numbers to use as seeds. Here's one just for you.

-
Worked perfectly, thanks. –  Derek Mar 16 '11 at 3:23
Was looking for this for a time... thanks, too! –  Marcel Nov 10 '11 at 22:27