I have a picture with randomly placed nodes. Sometimes the figure is nicer than other, and in the final version of the document, I'd like to have a nice figure.
I'd like to know how to get the seed used in each rendering of the figure and display it, so that I may use it with \pgfmathsetseed{}
. I know I could manually try a bunch of different values myself and set it myself in the end, but this is a fallback solution.
Below is a sample code, the part of the figure that looks nice or not nice depending on the random number generator's seed.
\resizebox{88mm}{!}{
\begin{tikzpicture}
\draw (0,0)[very thick] ellipse (1.5cm and 2.25cm);
\foreach \x in {1,2,...,80}{
\node (node\x) at (rand*1,rand*1.65) {$\bullet$};
}
\foreach \list in {
{66, 26, 63, 11, 10, 20, 61, 55},
{24, 10, 31, 8, 66, 4, 72, 1},
%...
} {
\foreach \i in \list {
\foreach \j in \list {
\draw (node\i.center) -- (node\j.center);
}
}
}
%...
%...
\end{tikzpicture}
}
How can I get the seed used by the random number generator, without setting it myself?
Best Answer
The value is stored in the counter
\pgfmath@rnd@z
. So you can read that off.