Macro with Random Number Not Working

I am attempting to create math fact worksheets for kids to practice, say, 2+3=5, but in every form of that equation:

2+3=_ _ _

2+_ _ _=5

_ _ _+3=5

_ _ _=2+3

5=_ _ _+3

5=2+_ _ _

I would like random numbers to select the addends as well as the structure.

Why does this code not work? \RandomType is probably where the bug lies, but I don't see the issue...

\documentclass{article}

\usepackage{ifthen}
\usepackage{pgf}
\usepackage{pgffor}

\setlength{\parindent}{0pt}

\pgfmathsetseed{\number\pdfrandomseed}

\newcommand{\InitVariables}
{
\pgfmathsetmacro{\a}{int(random(0,10))}
\pgfmathsetmacro{\b}{int(random(0,10))}
\pgfmathsetmacro{\c}{int(\a+\b)}
\pgfmathsetmacro{\r}{int(random(1,6))} % r will select one of the six types below.
}

\newcommand{\blank}{\_\_\_\_\_}

\newcommand{\TypeOne}
{
\large
\InitVariables
\huge$$\a+\b=$$\blank \hspace{3cm} $$\a+\b=\c$$

\vspace{0.8cm}
}
% Types two through six you can probably skip reading. Start reading code again at the next comment.
\newcommand{\TypeTwo}
{
\large
\InitVariables
\huge$$\a+\blank=\c$$ \hspace{3cm} $$\a+\b=\c$$

\vspace{0.8cm}
}

\newcommand{\TypeThree}
{
\large
\InitVariables
\huge$$\blank+\b=\c$$ \hspace{3cm} $$\a+\b=\c$$

\vspace{0.8cm}
}

\newcommand{\TypeFour}
{
\large
\InitVariables
\huge$$\blank=\a+\b$$ \hspace{3cm} $$\c=\a+\b$$

\vspace{0.8cm}
}

\newcommand{\TypeFive}
{
\large
\InitVariables
\huge$$\c=\blank+\b$$ \hspace{3cm} $$\c=\a+\b$$

\vspace{0.8cm}
}

\newcommand{\TypeSix}
{
\large
\InitVariables
\huge$$\c=\a+\blank$$ \hspace{3cm} $$\c=\a+\b$$

\vspace{0.8cm}
}

% start reading here again. :)

\newcommand{\RandomType}
{
\ifcase\r\relax%
\or \TypeOne
\or \TypeTwo
\or \TypeThree
\or \TypeFour
\or \TypeFive
\or \TypeSix
\fi
}

\begin{document}

\RandomType

% if I only write "\TypeSix" and \TypeFour" in the body, it compiles.
% but it does not compile as given

\end{document}


\RandomType tests \r which is initialized in \InitVariables. Since \TypeOne, ..., \TypeSix do not use \r, you must move \pgfmathsetmacro{\r}{int(random(1,6))} to \RandomType.