# Randomly sampling a text file in a TeX document (specifically exam)

Is there a way to sample random items from a series of text files and include them in exam questions?

# Context

I want to create vocab quizzes that comprise a random subset of the words the students have learned. So then I could test them on lists 1-2, or 1-6, or whatever, and not have to make up new quizzes manually (e.g., if I want to give different versions of the quiz to different sections of the same course).

The Cadillac version of this would also sample the definitions and generate a multiple-choice quiz, but I'm saving that for later. For starters, I just want to sample the terms and generate a list of short-answer questions.

# No MWE

There is no MWE yet because I don't know where to start working on this problem. If it can be done, what packages or commands should I familiarize myself with to put it together?

• You may add a minimal working example (MWE) without random choice, just to help us with a base to start with, thank you! Jun 13 '17 at 12:39
• Related: Assignments and Examinations (particularly the probsoln and datatool sections). Jun 13 '17 at 12:49
• Yes, it is possible. It is easier if the data is already stored in a TikZ array or comma (for example) delimited string for xstring. Personally I would use a C++ program to handle the random stuff and use LaTeX to do the formatting. See elfsoft2000.com/worksheets/index.htm Jun 13 '17 at 13:23
• Jun 13 '17 at 13:35

After following some of the leads offered above in the comments, I have a basic solution:

\documentclass[12pt,addpoints]{exam}
\usepackage{probsoln}

\begin{document}