# probsoln package FAQ

How do I stop \selectrandomly from using \item? 🔗

As from version 3.0, you can first load the randomly selected problems using \loadrandomproblems and then iterate through the data set using \foreachproblem. It’s then up to you to format the problems. For example, suppose you want multiple choice style questions formatted in a tabular style environment with the question in the first column and possible answers in the subsequent columns. Then you could define the problems in the following style:

\begin{defproblem}{sample}%
What is $2+3$? & 1 & 5 & 10 & 42
\end{defproblem}

Then load the problems (say you want to randomly select 10 problems from myproblems.tex):
\loadrandomproblems{10}{myproblems}

Now display the problems:
\begin{tabular}{lllll}
\bfseries Question & \bfseries A & \bfseries B & \bfseries C &
\bfseries D\\
\foreachproblem{\thisproblem\\}%
\end{tabular}

(If the table is likely to be longer than a page, then use longtable or supertabular instead of tabular.)

2020-07-03 11:21:46