Multiple test versions in the same output pdf using mcexam package

I'm using the package mcexam to build tests with randomised multiple choice questions and randomised answers.

The package usage is as follows:

\usepackage[output=exam, numberofversions=58, version=26, randomizequestions=true,randomizeanswers=true]{mcexam}


where with the option numberofversions I set the number of randomised tests, and with the option version I print the 26th version as a pdf output.

I would ask if it is possible to print more versions in the same output pdf (fo example from 1 to 25), without changing the version number every time to create the different output. Thank you

This is easy to achieve with \foreach. But care must be taken, to ensure that you don't end up with duplicate tests.

A randomization table is generated by the mcquestions environment, i.e. it will be different for each loop. So the tests will look randomized, but you may end up with duplicates.

To prevent this, seed must be set to constant value before the mcquestions environment and the version must be incremented in each loop.

The incementation is done by \foreach and version and seed are set with \setkeys.

Here is the code:

\documentclass[a4paper]{article}
\begin{document}
\foreach \i in {1,...,25}{
\newpage
\setkeys{mcexam.sty}{version=\i,seed=123}
\begin{mcquestions}
\question How much is $2+2$?
\question How much is $5-3$?
\question How much is $0 \times 2$?