# How can I randomly perturb the position of a grid of nodes?

I have a grid of nodes generated by the following code:

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\tikzset{
small-node/.style={
shape=circle,
fill=white,
draw,
minimum size=+4mm}
}
\begin{document}
\begin{tikzpicture}
\foreach \i in {0,...,4}
\foreach \j in {0,...,4}
\node [small-node] (n-\i\j) at (\i,\j) {};
\foreach \i in {0,...,4}
\foreach \j [count=\jj] in {0,...,3}
\draw (n-\i\j) -- (n-\i\jj) (n-\j\i) -- (n-\jj\i);
\end{tikzpicture}
\end{document}


Is there a way that as each node is created, I can generate two random numbers in the range (-0.5,0.5) and add those two the x and y coordinates of the node so that they are no longer in a rectilinear grid pattern?

You can use the rnd or rand pgf functions. rnd generates a pseudo-random number between 0 and 1 with a uniform distribution, and rand does the same between -1 and 1.
Simply change the node declaration line with the following:
\node [small-node] (n-\i\j) at (\i + 0.5*rand,\j + 0.5*rand) {};