leaders and evaluation order

enter image description here

There's probably a tikz way of getting the coordinates but I use the pdftex primitive here. Use glue instead of leaders, but measure the distance and overlay some boxes on a second run.

\documentclass{minimal}
\usepackage{tikz}
\newcommand\randdot{%
\tikz{\pgfmathsetmacro{\r}{0.01+0.05*random()}\fill (0,0) circle (\r);}\ }

\begin{document}
\makeatletter

\randdot\randdot\randdot\randdot\randdot\randdot


Test \leaders\hbox{\randdot\ }\hfill 3 \hfill \ 

Test %
\pdfsavepos\write\@auxout{\gdef\noexpand\leada{\the\pdflastxpos}}%
\ifx\leada\@undefined\else
\rlap{%
\dimen@\leadb sp
\advance\dimen@ - \leada sp
\loop
\setbox0\hbox{\randdot\ }%
\advance\dimen@-\wd\z@
\ifdim\dimen@>\z@
\box\z@
\repeat
}%
\fi
\hfill
\pdfsavepos\write\@auxout{\gdef\noexpand\leadb{\the\pdflastxpos}}%
4 \hfill \ 

\randdot\randdot\randdot\randdot\randdot\randdot

\end{document}

The TikZ way David mentions is the now-famous (thanks to Andrew Stacey and Peter Grill) \tikzmark macro. Basically you leave TikZ coordinates at places you like and then refer to them in a later TikZ picture.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{randlead/.style={decoration={
        markings,% switch on markings
        mark=% actually add a mark
        between positions 0 and 1 step 5mm
        with
            {
            \pgfmathsetmacro{\r}{0.01+0.05*random()}\fill (0,0) circle (\r);
            }
        },
        decorate
    }
}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture,baseline=-0.5ex] \node (#1) {};}

\begin{document}
Test\tikzmark{a1} \hfill \tikzmark{a2}3 \hfill 

Test some text and then Test \tikzmark{a3} \hfill \tikzmark{a4}165 \hfill 

\begin{tikzpicture}[overlay,remember picture]
\draw[randlead] (a2) -- (a1);
\draw[randlead] (a4) -- (a3);
\end{tikzpicture} 
\end{document}

enter image description here

Further tweaks are possible but take this as a proof of concept.