0

I want to use variables to store a value in TikZ and do computations based on it. For instance, I want to have variables a,b and c for the following purpose in TikZ:

\draw (a,b) circle (r)

I should be able to assign a,b and c (these can be decimals) and the circle must be drawn at the desired location with the desired radius.

How do I go about doing this?

PS: Essentially, I want to draw 100 small circles inside a unit square at random locations. Hence, I want the variables a, b and c to take random values. Below is my attempt, which doesn't work.

\documentclass{standalone}

\usepackage[first=0, last=1000]{lcg}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\foreach \i in {1,2,...,100}{
    \def{a}{\rand\arabic{rand}}
    \def{b}{\rand\arabic{rand}}
    \draw(a/1000,b/1000) circle (0.001);
}
\end{tikzpicture}

\end{document}

0 Answers0