The result of the calculation can be directly assigned to a macro using \pgfmathsetmacro
.
Table cells are local groups, therefore the following definition of \allan
first performs the calculations, defines a macro for the table rows with the expanded calculation results and calls the macro to actually set the rows:
\newcommand{\allan}{
\pgfmathsetmacro\RandomA{random(10,99)}%
\pgfmathsetmacro\RandomB{random(0, int(9 - mod(\RandomA,10)))}%
\edef\next{%
& \RandomA \noexpand\\%
+ & \RandomB \noexpand\\%
}%
\next
}
Full example:
\documentclass{article}
\usepackage{geometry}
\geometry{letterpaper, portrait, margin=1.5cm, tmargin=2.5cm }
\usepackage{tabularx}
\usepackage{array}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgf}
\DeclareMathSizes{10.0}{17}{12}{12}
\begin{document}
\begin{flushleft}
% fixed width, right justified column
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
% print 2 numbers
%
% 42
% + 7
%
\newcommand{\allan}{
\pgfmathsetmacro\RandomA{random(10,99)}%
\pgfmathsetmacro\RandomB{random(0, int(9 - mod(\RandomA,10)))}%
\edef\next{%
& \RandomA \noexpand\\%
+ & \RandomB \noexpand\\%
}%
\next
}
% create 7x9 grid of addition problems
\foreach \n in {0,...,8}{
\foreach \n in {0,...,6}{
\begin{tabularx}{1.8cm}{>{$}R{.3cm}<{$} >{$}R{.7cm}<{$}}
\allan
\hline
\end{tabularx}
\hfill
}
\par
\vspace{1.5cm}
}
\end{flushleft}
\end{document}

Variant without tabularx
, which fills the space on the page:
\documentclass{article}
\usepackage{geometry}
\geometry{letterpaper, portrait, margin=1.5cm, tmargin=2.5cm }
\usepackage{tabularx}
\usepackage{array}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{pgf}
\DeclareMathSizes{10.0}{17}{12}{12}
\begin{document}
\begin{flushleft}
\setlength{\parskip}{0pt plus 1fill}
\setlength{\parfillskip}{0pt}
\setlength{\tabcolsep}{2\tabcolsep}% make the lines a little longer
% print 2 numbers
%
% 42
% + 7
%
\newcommand{\allan}{
\pgfmathsetmacro\RandomA{random(10,99)}%
\pgfmathsetmacro\RandomB{random(0, int(9 - mod(\RandomA,10)))}%
\edef\next{%
& \noexpand\leavevmode
\ifnum\RandomA<10 \noexpand\hphantom{0}\fi % if \RandomA can be smaller than ten
\RandomA \noexpand\\%
+ & \RandomB \noexpand\\%
}%
\next
}
% create 7x9 grid of addition problems
\foreach \n in {0,...,8}{
\foreach \n in {0,...,6}{
\begin{tabular}{>{$}l<{$} @{$\;$} >{$}r<{$}}
\allan
\hline
\vadjust{\vspace{1.1cm}}% place for result
\end{tabular}%
\hfill
}%
\par
}
\flushbottom
\newpage
\end{flushleft}
\end{document}

Hint: \pgfmathsetseed{<number>}
can be used to get reproducible results.