Here's an implementation using the sagetex package. It utilizes the open source computer algebra system, SAGE, which is not part of the LaTeX distribution. This gives access to programming in Python as well.
\documentclass{article}%
% -----------------------------The preamble ------------------------------------
\usepackage{fix-cm}% allow for a bigger font
% mathematical typesetting, fonts, and symbols
\usepackage{amsmath, amsfonts, amssymb}
\usepackage[T1]{fontenc}% change the fonts
\usepackage[margin=.5in]{geometry}% sets the margins
\usepackage{sagetex}% use Sage for it's math ability
\pagestyle{empty} % remove the page numbers
% -----------------------------End of the preamble ------------------------------
\begin{document}
\fontsize{17pt}{20pt}\selectfont %sets font size
\noindent
\begin{sagesilent}
def Problems(rows,columns):
output = r""
output += r"\begin{tabular}{r"+"r"*(2*columns)+"}"
for i in range(0,rows):
minuend = [Integer(randint(5,25)) for i in range(0,columns)]
subtrahend = [Integer(randint(-10,10)) for i in range(0,columns)]
for j in range(0,columns):
if j<columns-1:
output += r"%s & \hspace{.2in} &"%(minuend[j])
else:
output += r"%s \\"%(minuend[j])
##### second row #####
for j in range(0,columns):
if j<columns-1:
output += r"\underline{- %s} & \hspace{.5in} &"%(subtrahend[j])
else:
output += r"\underline{- %s}\\\\\\"%(subtrahend[j])
output += r"\end{tabular}"
return output
outputP = r""
outputP += Problems(4,5)
\end{sagesilent}
\begin{center}
\sagestr{outputP}
\end{center}
\end{document}
The output running in Cocalc is shown:

Some comments:
- output += r"\begin{tabular}{r"+"r"*(2*columns)+"}" uses Python to set the number of columns. Since there should be space between the problems, extra columns are added. Being able to adjust the columns used makes the
sagetex approach very convenient.
- minuend = [Integer(randint(5,25)) for i in range(0,columns)] sets the minuend as a random integer between 5 and 25 while subtrahend = [Integer(randint(-10,10)) for i in range(0,columns)] values are set between -10 and 10.
- The fontsize has been increased to make the worksheet easier to read.
- outputP += Problems(4,5) results in the creation of 4 rows of 5 problems (20 problems). By adjusting these numbers you can easily change the number of problems in your worksheet.
The easiest way to work with sagetex is by opening a free Cocalc account.
TiKz/PGFpackage to do this kind of random exercices. It has a mathematic library that could help you. I can't do a full answer right now, I'll make one as soon as I can. – Alain Remillard Dec 27 '19 at 07:05