diff options
author | Karl Berry <karl@freefriends.org> | 2017-09-12 22:16:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-09-12 22:16:46 +0000 |
commit | 645fea73b8e358e5c54f71495e375bce13497714 (patch) | |
tree | a8a2811e06438c5ec0bc0c9b120b8d2e716b423d /Master/texmf-dist/source/generic | |
parent | 572e6e6b61efe78bcd5a3a4b43cafcb0e97eb518 (diff) |
randomlist (12sep17)
git-svn-id: svn://tug.org/texlive/trunk@45281 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic')
-rw-r--r-- | Master/texmf-dist/source/generic/randomlist/randomlist.dtx | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/generic/randomlist/randomlist.dtx b/Master/texmf-dist/source/generic/randomlist/randomlist.dtx index f1d08d33d14..d62192fd45d 100644 --- a/Master/texmf-dist/source/generic/randomlist/randomlist.dtx +++ b/Master/texmf-dist/source/generic/randomlist/randomlist.dtx @@ -1,10 +1,10 @@ % \iffalse % %% randomlist.dtx -%% Copyleft 2013-2016 J.-C. Charpentier & C. Tellechea +%% Copyleft 2013-2017 J.-C. Charpentier & C. Tellechea % %% Packages `randomlist' to use with (La)eTeX -%% Copyleft (L) 2013-2016 Jean-C\^ome Charpentier & Christian Tellechea. +%% Copyleft (L) 2013-2017 Jean-C\^ome Charpentier & Christian Tellechea. % \fi % %% \CharacterTable @@ -77,6 +77,9 @@ \newcommand*\environ[1]{\texttt{#1}} \newcommand*\Environ[1]{\texttt{#1}\index{#1=\texttt{#1}}} \makeatletter +\edef\quotechar{\string!} +\edef\actualchar{\string=} +\edef\verbatimchar{\string+} \def\SpecialPageIndex#1{% \immediate\write\@indexfile{% \string\indexentry{\expandafter\@gobble\string#1\actualchar @@ -1140,6 +1143,9 @@ This file use lines which aren't data lines and weird separator. % \changes{v1.2}{2016/07/13}{% % First public release. % } +% \changes{v1.3}{2017/09/11}{% +% Random operations are \global. +% } % \CheckSum{0} % \iffalse %<*latex> @@ -1150,7 +1156,7 @@ This file use lines which aren't data lines and weird separator. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1995/06/01] \ProvidesPackage{randomlist} - [2016/07/13 v1.2 Package for random list (JCC, CT)] + [2017/09/11 v1.3 Package for random list (JCC, CT)] % \end{macrocode} % \LaTeX's wrapper has the possibility to use option. There is only % one option: the seed one. It requires the \package{(x)keyval} package. @@ -1326,9 +1332,9 @@ This file use lines which aren't data lines and weird separator. \newcount\RL@random@b \def\RLsetrandomseed#1{% \ifnum#1=0 - \RL@random \numexpr \time + \year * \month * \day \relax + \global\RL@random \numexpr \time + \year * \month * \day \relax \else - \RL@random \numexpr \ifnum#1<0 -\fi#1 \relax + \global\RL@random \numexpr \ifnum#1<0 -\fi#1 \relax \fi } % \end{macrocode} @@ -1362,19 +1368,19 @@ This file use lines which aren't data lines and weird separator. % \[x_{n+1} = 7^5(x_n \pmod{q}) - r\times\mathrm{E}\left(\frac{x_n}{q}\right).\] % If $x_{n+1} < 0$ then $x_{n+1} = x_{n+1} + 2^{31}-1$ % \begin{macrocode} - \RL@random@a=\RL@random - \divide\RL@random@a 127773 - \RL@random@b=\RL@random@a - \multiply\RL@random@a -2836 - \multiply\RL@random@b -127773 - \advance\RL@random\RL@random@b - \multiply\RL@random 16807 - \advance\RL@random\RL@random@a + \global\RL@random@a=\RL@random + \global\divide\RL@random@a 127773 + \global\RL@random@b=\RL@random@a + \global\multiply\RL@random@a -2836 + \global\multiply\RL@random@b -127773 + \global\advance\RL@random\RL@random@b + \global\multiply\RL@random 16807 + \global\advance\RL@random\RL@random@a % \end{macrocode} % If random number is negative add $2^{31}-1$. % \begin{macrocode} \ifnum\RL@random<0 - \advance\RL@random 2147483647 + \global\advance\RL@random 2147483647 \fi } % \end{macrocode} @@ -1391,10 +1397,10 @@ This file use lines which aren't data lines and weird separator. % \end{macrocode} % Compute $|\RL@random| \pmod{\mathtt{\string#1}}$. % \begin{macrocode} - \RL@random@a=\RL@random - \RL@random@b=\RL@random - \divide\RL@random@a \numexpr#1\relax - \RL@random@b \numexpr\RL@random@b - \RL@random@a * (#1)\relax + \global\RL@random@a=\RL@random + \global\RL@random@b=\RL@random + \global\divide\RL@random@a \numexpr#1\relax + \global\RL@random@b \numexpr\RL@random@b - \RL@random@a * (#1)\relax \expandafter\edef\csname #2\endcsname{\number\RL@random@b}% }% % \end{macrocode} |