It is a rather common practice that teachers prepare multiple versions of a test for the same exam in order to reduce cheating. Can \LaTeX do this? I want to design a math test with a set of parameters that are randomly chosen from a given set to create problems that have same wording but different numbers (something that online homework systems do).
Is such a thing possible with any latex package? Is it possible at all?
A basic example is: Produce 10 pages, each a with a copy of the following question
What is the sum $p+q$?
Where the program chooses and inserts $p$ randomly from the range 20 to 30 and $q$ from 50 to 60.
\int_rand:nn(might want to create a document interface:\usepackage{xparse}\ExplSyntaxOn\NewExpandableDocumentCommand \randint { o m } { \IfValueTF { #1 } { \int_rand:nn { #1 } { #2 } } { \int_rand:n { #2 } } }\ExplSyntaxOff, now you got a macro\randintthat takes an optional and a mandatory argument. It returns a random int from#1to#2(if#1wasn't used defaults to 1). So for your$p$this would be\randint[20]{30}.) – Skillmon Sep 16 '19 at 22:26sagetexpackage. You can even create an answer key as well at the same time. – DJP Sep 17 '19 at 00:29