[Tex/LaTex] Have a new seed in pgfmath more often

pgfmathrandom numbers

I'm using pgfmath in my code since I need some randomness and I want the seed used for the randomness to be updated each time I compile. I read that pgfmath is updating the seed every minute, which is not enough for what I'm doing. Is there a way to force him to update every second or, even better, every millisecond?

Here is a toy example of code which prints randomly 4 elements in the list {one, two, three, four}

\documentclass[11pt,a4paper]{report}
\usepackage{tikz}
\begin{document}
\pgfmathdeclarerandomlist{mylist}{{one}{two}{three}{four}}
\pgfmathrandomitem\elem{mylist}\elem\  
\pgfmathrandomitem\elem{mylist}\elem\   
\pgfmathrandomitem\elem{mylist}\elem\  
\pgfmathrandomitem\elem{mylist}\elem
\end{document}

Best Answer

If you use pdflatex or LuaLaTeX, then

\documentclass{article}
\usepackage{pgf}
\pgfmathsetseed{\number\pdfrandomseed}
\begin{document}

\pgfmathsetmacro{\test}{rand}\test

\end{document}

will pick a random seed each time. With XeLaTeX there's nothing similar. The value of \pdfrandomseed doesn't change during a run, though.

Related Question