diff options
author | Karl Berry <karl@freefriends.org> | 2018-12-07 22:52:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-12-07 22:52:08 +0000 |
commit | 01651bbd8c05e990ab60754f83cca88670045846 (patch) | |
tree | f562463d39d6e408d2ee5f025089f62b09da21f2 /Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | |
parent | b15665291da56772687808588be2d9dee0d24094 (diff) |
l3kernel (7dec18)
git-svn-id: svn://tug.org/texlive/trunk@49348 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3tl.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 30ef7b74f8d..e6613f26e22 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-11-19} +% \date{Released 2018-12-06} % % \maketitle % @@ -1009,6 +1009,23 @@ % \end{texnote} % \end{function} % +% \begin{function}[EXP, added = 2016-12-06] +% {\tl_rand_item:N, \tl_rand_item:c, \tl_rand_item:n} +% \begin{syntax} +% \cs{tl_rand_item:N} \meta{tl~var} +% \cs{tl_rand_item:n} \Arg{token list} +% \end{syntax} +% Selects a pseudo-random item of the \meta{token list}. If the +% \meta{token list} is blank, the result is empty. This is not yet +% available in \XeTeX{}. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{item} +% does not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% % \section{Viewing token lists} % % \begin{function}[updated = 2015-08-01]{\tl_show:N, \tl_show:c} @@ -2964,6 +2981,19 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\tl_rand_item:n, \tl_rand_item:N, \tl_rand_item:c} +% Importantly \cs{tl_item:nn} only evaluates its argument once. +% \begin{macrocode} +\cs_new:Npn \tl_rand_item:n #1 + { + \tl_if_blank:nF {#1} + { \tl_item:nn {#1} { \int_rand:nn { 1 } { \tl_count:n {#1} } } } + } +\cs_new:Npn \tl_rand_item:N { \exp_args:No \tl_rand_item:n } +\cs_generate_variant:Nn \tl_rand_item:N { c } +% \end{macrocode} +% \end{macro} +% % \subsection{Viewing token lists} % % \begin{macro}{\tl_show:N, \tl_show:c, \tl_log:N, \tl_log:c, \@@_show:NN} |