I want to run the steps of a loop in random order and also save the order in which the iterations were carried out:
\documentclass[english]{article}
\usepackage{tikz}
\newcommand\NonRandomizedIndexList{3,4,5,6,7}
\newcommand\PermutedIndexList{3,5,6,4,7}
%
\begin{document}
\foreach \x in \PermutedIndexList {
Run a complicated code that involves \x .\\
}\\
Remember that the order in which the loop was run was: \PermutedIndexList.
\end{document}
My question is how can I generate in LaTex the Macro PermutedIndexList from the original set NonRandomizedIndexList. In Matlab, function `randperm()' would do the job, but I am looking for solution within LaTeX.


PermutedIndexListMacro so that it works in the foreach loop – Sebastian Sep 23 '15 at 09:13