I have a list and then two randomly selected items from them.
But those two items are always the same. Why?
\documentclass{article}
\usepackage{pgf}
\usepackage{pgffor}
\pgfmathsetseed{\number\pdfrandomseed}
\newcommand{\InitVariables}
{%
\pgfmathdeclarerandomlist{List}{{2}{3}{4}{5}{6}{7}{8}{9}}
\pgfmathrandomitem{\VarA}{List}
\pgfmathrandomitem{\VarB}{List}
}
\begin{document}
ATTEMPT ONE
\InitVariables
Variable A is \VarA .
Variable B is \VarB .
ATTEMPT TWO
\InitVariables
Variable A is \VarA .
Variable B is \VarB .
ATTEMPT THREE
\InitVariables
Variable A is \VarA .
Variable B is \VarB .
\end{document}

\VarAis 'choose a random item' rather than some random item and\VarBis 'choose a random item' rather than some random item, then\VarA \VarBis 'choose a random item choose a random item'. So it should choose a random item twice and they shouldn't always be the same. – cfr Sep 26 '17 at 01:37\pgfmath@randomtempthen defines varA to choose the \pgfmath@randomtemp'th item, then it puts another random number into \pgfmath@randomtemp again and defines varB to chooose the \pgfmath@randomtemp 'th item so varA and varB both get defined to choose the \pgfmath@randomtemp 'th ite and \pgfmath@randomtemp is the second random number calculated – David Carlisle Sep 26 '17 at 06:58