summaryrefslogtreecommitdiff
path: root/texmf-dist/tex/latex/acrotex/aebrandom.def
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2017-07-12 23:26:39 +0900
committerNorbert Preining <norbert@preining.info>2017-07-12 23:26:39 +0900
commit01c9ee84c09adfc3efe1cd93191a9c0473f985fe (patch)
tree6fe7c1648fa25e3dcc9b4c67657b89ac1525f289 /texmf-dist/tex/latex/acrotex/aebrandom.def
parent542c5a785f8db8d4469e296c69c86bc030285f68 (diff)
add acrotex
Diffstat (limited to 'texmf-dist/tex/latex/acrotex/aebrandom.def')
-rw-r--r--texmf-dist/tex/latex/acrotex/aebrandom.def168
1 files changed, 168 insertions, 0 deletions
diff --git a/texmf-dist/tex/latex/acrotex/aebrandom.def b/texmf-dist/tex/latex/acrotex/aebrandom.def
new file mode 100644
index 00000000..f5554385
--- /dev/null
+++ b/texmf-dist/tex/latex/acrotex/aebrandom.def
@@ -0,0 +1,168 @@
+%%
+%% This is file `aebrandom.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% exerquiz.dtx (with options: `copyright,randomize')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Exerquiz.sty package, %%
+%% Copyright (C) 1999-2017 D. P. Story %%
+%% dpstory@uakron.edu %%
+%% %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ProvidesFile{aebrandom.def}
+ [2017/03/16 v7.8g %
+ Exerquiz support for randomization (dps)]
+\@ifundefined{nextrandom}{\input{random.tex}}{}
+\def\nextrandom{\begingroup
+ \ifnum\randomi<\@ne % then initialize with time
+ \global\randomi\time
+ \global\multiply\randomi388 \global\advance\randomi\year
+ \global\multiply\randomi31 \global\advance\randomi\day
+ \global\multiply\randomi97 \global\advance\randomi\month
+ \message{Randomizer initialized to \the\randomi.}%
+ \nextrandom \nextrandom \nextrandom
+ \xdef\InitSeedValue{\the\randomi}%
+ \fi
+ \count@ii\randomi
+ \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836
+ \count@\count@ii
+ \multiply\count@ii 127773
+ \global\advance\randomi-\count@ii % random mod 127773
+ \global\multiply\randomi 16807
+ \multiply\count@ 2836
+ \global\advance\randomi-\count@
+ \ifnum\randomi<\z@ \global\advance\randomi 2147483647\relax\fi
+ \endgroup
+}
+\def\@ansChoices[#1]%
+{%
+ \global\let\@tempholdSaveAns\@empty % 5/24
+ \global\let\@tempholdSaveChoice\@empty % 5/24
+ \global\let\bChoiceLabel\@empty % 5/24
+ \ifeq@randomizeallChoices
+ \setkeys{bchoice}{#1,random=true}\else
+ \setkeys{bchoice}{#1}\fi
+ \global\eq@tabColCnt=0
+ \ifeq@randomizeChoices\expandafter\@@bChoices
+ \else\expandafter\@@ansChoices\fi
+}
+\def\@@ansChoices{%
+ \ifnum\aeb@numCols=1 % list mode
+ \def\eq@next{\@layoutListAns}%
+ \else % tabular mode
+ \edef\eq@next{\noexpand\@layoutTabularAns{\bChoiceNumCols}}%
+ \fi
+ \eq@next
+}
+\newcount\aeb@numChoices
+\newcount\aeb@ranChoice
+\newtoks\aeb@hold\aeb@hold={}
+\def\@@bChoices{\gdef\@temphold{}\gdef\@tempholdrandom{}%
+ \gdef\@tempholdfreeze{}\aeb@searchfortoken{\@getAns}%
+}
+\def\aeb@searchfortoken#1{%
+ \@ifnextchar\Ans{\advance\aeb@numChoices1\relax#1}
+ {\@ifnextchar\eFreeze{\expandafter\@getFreezeAns\@gobble}
+ {\@ifnextchar\par{\def\@@temp{\aeb@searchfortoken{#1}}%
+ \expandafter\@@temp\@gobble}{\@eChoices}}}%
+}
+\long\def\@getAns\Ans#1\eAns{%
+ \g@addto@macro\@temphold{{\Ans#1\eAns}}%
+ \aeb@searchfortoken{\@getAns}%
+}
+\def\@getFreezeAns{\aeb@searchfortoken{\@@getFreezeAns}}
+\long\def\@@getFreezeAns\Ans#1\eAns{%
+ \g@addto@macro\@tempholdfreeze{\Ans#1\eAns}%
+ \aeb@searchfortoken{\@@getFreezeAns}%
+}
+\long\def\@eChoices#1\eChoices{%
+ \aeb@randomizeChoices{\the\aeb@numChoices}%
+}
+\def\aeb@randomizeChoices#1{%
+ \setrannum{\aeb@ranChoice}{1}{#1}
+ \count0=0 \aeb@hold=\expandafter{\@temphold}\def\@temphold{}%
+ \expandafter\@tfor\expandafter
+ \@temp\expandafter:\expandafter=\the\aeb@hold \do {%
+ \advance\count0by1
+ \ifnum\count0=\aeb@ranChoice
+ \aeb@hold=\expandafter\expandafter\expandafter
+ {\expandafter\@tempholdrandom\@temp}%
+ \edef\@tempholdrandom{\the\aeb@hold}%
+ \else
+ \aeb@hold=\expandafter\expandafter\expandafter
+ {\expandafter\@temphold\expandafter{\@temp}}%
+ \edef\@temphold{\the\aeb@hold}%
+ \fi
+ }%
+ \aeb@numChoices=#1
+ \advance\aeb@numChoices-1
+ \ifnum\aeb@numChoices=0\relax
+ \def\aeb@next{\aeb@finishedRandomizing}\else
+ \def\aeb@next{\aeb@randomizeChoices{\the\aeb@numChoices}}\fi
+ \aeb@next
+}
+\def\aeb@finishedRandomizing{%
+ \aeb@hold=\expandafter\expandafter\expandafter
+ {\expandafter\@tempholdrandom\@tempholdfreeze}%
+ \gdef\@temphold{}\gdef\@tempholdrandom{}\gdef\@tempholdfreeze{}%
+ \edef\finished@Randomizing{%
+ \noexpand\@@ansChoices
+ \the\aeb@hold
+ \noexpand\eChoices}%
+ \finished@Randomizing
+}
+\def\saveRandomSeed{\PackageInfo{exerquiz}
+ {The command \string\saveRandomSeed\space
+ is deprecated.\MessageBreak Seed automatically saved}}
+\@ifpackageloaded{ran_toks}{%
+ \let\inputRandomSeed\useLastAsSeed
+ \let\useRandomSeed\useThisSeed
+}{%
+ \def\inputRandomSeed{\eq@readRandomData}%
+ \def\useRandomSeed#1{\saveseedfalse\randomi=#1}%
+}
+\def\InitSeedValue{\the\randomi} % dps
+\@ifundefined{ifsaveseed}{\newif\ifsaveseed\saveseedtrue}{} % dps
+\def\eq@writeRandomData
+{%
+ \ifsaveseed
+ \@ifundefined{saveseedinfo}{\newwrite\saveseedinfo}{}
+ \immediate\openout \saveseedinfo \jobname_rt.sav
+ \let\verbatim@out\saveseedinfo
+ \def\eqrt@msgi{initializing seed value}%
+ \def\eqrt@msgii{last random number used}%
+ \uccode`c=`\%\uppercase{%
+ \immediate\write\verbatim@out
+ {\InitSeedValue\space c \eqrt@msgi}%
+ \immediate\write\verbatim@out
+ {\the\randomi\space c \eqrt@msgii}%
+ }\immediate\closeout\saveseedinfo
+ \fi
+}
+\AtEndDocument{\eq@writeRandomData}
+\def\eq@readRandomData{\IfFileExists{\jobname_rt.sav}{%
+ \PackageInfo{exerquiz}{Inputting \jobname_rt.sav}%
+ \@ifundefined{readsavfile}{\newread\readsavfile}{}%
+ \openin\readsavfile=\jobname_rt.sav
+ \read\readsavfile to \InitSeedValue
+ \read\readsavfile to \eqlastRandomNum
+ \closein\readsavfile
+ \randomi=\eqlastRandomNum
+ \xdef\InitSeedValue{\the\randomi}%
+ \immediate\closeout\readsavfile
+}{%
+ \PackageInfo{exerquiz}{\jobname_rt.sav cannot
+ be found, \MessageBreak
+ using the random initializer}%
+}}
+\endinput
+%%
+%% End of file `aebrandom.def'.