0

Is there a way to include a hyperlink on a page that sends you to a random page in your pdf (which is different each time)?

If I try to use pgf, I can output a random number within a certain range, but I don't know how to make part of a command instead of something that latex will print.

\usepackage{pgf}

\pgfmathsetseed{\number\pdfrandomseed} % to ensure that it is randomized \newcommand{\thecmd}[1]{% \pgfmathsetmacro{\a}{int(#1-#1/4)}% \pgfmathsetmacro{\b}{int(#1+#1/4)}% \pgfmathsetmacro{\thenum}{int(random(\a,\b))}% \thenum% }%

\newcommand{\random}{\thecmd{4}}

\begin{document} \hyperlink{page.\random}{ 1}

\newpage \newpage \newpage \newpage \newpage

MS-SPO
  • 11,519

0 Answers0