Last year, I came up with a solution to randomly display the names of my students in a presentation using the package tikz. Unfortunately, I'm not a LaTeX guru, and it's far from perfect:
- Compilation is really slow (I've heard for loops should be forbidden...).
- The random generator doesn't seem to have a nice uniform distribution (at least for every seeds).
- I need to manually set a seed.
Actually, point 1. is what really matters for me.
How would you randomly display a word from a list of words previously defined?
Here the solution I'm using until now:
\documentclass[french]{beamer}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\pgfmathdeclarerandomlist{classe}{{Adeline}{Apolline}{Alric}{Jana}{Alex}{Axel}{Baptiste}{Océanne}{Joris}{Lucas C.}{Esteban}{Margaux}{Emma F.}{Louis}{Nathan}{Grégoire}{Jérémy}{Emma L.}{Mélina}{Arthur}{Lea}{Laurette}{Flora}{Manon}{Julie}{Lucas T.}{Maëva}}
\newcommand{\eleve}[1]{
\pgfmathsetseed{1} % seed I need to change
\foreach \i in {0,...,#1}{\pgfmathrandomitem{\a}{classe}}
\pgfmathrandomitem{\a}{cinquiemed} \a
}
\begin{document}
\begin{frame}
\begin{enumerate}
\item<1-> $9 \times 7 = \action<3->{63}$ \hfill \action<2->{\eleve{0}}
\item<4-> $12 \times 12 = \action<6->{144}$ \hfill \action<5->{\eleve{1}}
\item<7-> $6 \times 7 = \action<9->{42}$ \hfill \action<8->{\eleve{2}}
\end{enumerate}
\end{frame}
\end{document}
And you can look at the last slide below to see the result:
