난수를 생성해 무작위로 좌표를 찍어보려고 하는데... for문을 돌리면 왜 같은 수만 나오는걸까요?
\documentclass[]{article}
\usepackage{tikz}
\usepackage{lcg}
\begin{document}
\pagenumbering{gobble}
\begin{figure}
\begin{tikzpicture}[scale=1]
\draw [->] (-1,0) -- (5,0); %x
\draw [->] (0,0) -- (0,5); %y
\foreach \i in {1,...,5}{
\reinitrand[first=1, last=50, counter=num] \rand
\node at (0.1*\thenum, 0.8*\i) {$\thenum$};
}
\end{tikzpicture}
\end{figure}
\end{document}
소스코드입니다.
실행하면 19만 나오네요.
KTUG 한국 텍 사용자 그룹