texlive[49419] Master: luarandom (15dec18)
commits+karl at tug.org
commits+karl at tug.org
Sat Dec 15 23:41:11 CET 2018
Revision: 49419
http://tug.org/svn/texlive?view=revision&revision=49419
Author: karl
Date: 2018-12-15 23:41:11 +0100 (Sat, 15 Dec 2018)
Log Message:
-----------
luarandom (15dec18)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/libexec/ctan2tds
trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/lualatex/luarandom/
trunk/Master/texmf-dist/doc/lualatex/luarandom/Changes
trunk/Master/texmf-dist/doc/lualatex/luarandom/README
trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.pdf
trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.tex
trunk/Master/texmf-dist/tex/lualatex/luarandom/
trunk/Master/texmf-dist/tex/lualatex/luarandom/luarandom.sty
trunk/Master/tlpkg/tlpsrc/luarandom.tlpsrc
Added: trunk/Master/texmf-dist/doc/lualatex/luarandom/Changes
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luarandom/Changes (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luarandom/Changes 2018-12-15 22:41:11 UTC (rev 49419)
@@ -0,0 +1,4 @@
+..... luarandom.sty
+0.01 2018-12-15 first CTAN version (hv)
+
+
Added: trunk/Master/texmf-dist/doc/lualatex/luarandom/README
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luarandom/README (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luarandom/README 2018-12-15 22:41:11 UTC (rev 49419)
@@ -0,0 +1,12 @@
+# luarandom.sty #
+
+This package provides some macros for creating random number
+lists between a nd b (Integers). This list can have multiple
+numbers or not.
+
+The macros for random numbers can only be used with LuaLaTeX!
+
+hvoss at tug.org
+
+
+%% $Id: README 862 2018-12-15 16:25:55Z herbert $
Property changes on: trunk/Master/texmf-dist/doc/lualatex/luarandom/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.pdf 2018-12-15 01:23:18 UTC (rev 49418)
+++ trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.pdf 2018-12-15 22:41:11 UTC (rev 49419)
Property changes on: trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.tex 2018-12-15 22:41:11 UTC (rev 49419)
@@ -0,0 +1,90 @@
+%% $Id: luarandom-doc.tex 862 2018-12-15 16:25:55Z herbert $
+\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,
+ headings=small, headinclude=false,footinclude=false,oneside,abstract=on]{pst-doc}
+
+\usepackage{xcolor,pstricks,multido}
+\usepackage{auto-pst-pdf-lua}
+
+\usepackage{luarandom}
+\let\pstMathFV\fileversion
+\lstset{pos=t,wide=true,language=[LaTeX]{TeX},basicstyle=\footnotesize\ttfamily}
+%
+\makeatletter
+\def\DefOfOperator{\@ifstar{\DefOfOperator@}{\DefOfOperator@@}}
+\def\DefOfOperator@#1#2#3#4{{\operator at font#1}:\left\{\begin{array}{ccc} #2&\to\\
+x&\mapsto\end{array}\right.}
+\def\DefOfOperator@@#1#2#3{{\operator at font#1}:\left\{\begin{array}{ccc} #2&\to\\
+x&\mapsto&{\operator at font#1}(x)\end{array}\right.}
+\makeatother
+
+
+\begin{document}
+
+\title{\texttt{luarandom}}
+\subtitle{Create a list of random numbers with or without multiple values; v. 0.01}
+\author{Herbert Vo\ss}
+\docauthor{Herbert Vo\ss}
+\date{\today}
+\maketitle
+
+\tableofcontents
+
+
+\section{Random numbers}
+Package \LPack{luarandom} supports the creation of random number lists where a number will
+appear only once or multiple times. With Lua\TeX\ all random numbers are build with the help of Lua which
+has the advantage that there will be no problem with \TeX's limited parameter stack size.
+However, this package will \emph{not} run with other \TeX-engines than Lua\LaTeX.
+
+
+\section{The Macros}
+\begin{BDef}
+\Lcs{makeSimpleRandomNumberList}\Largb{Left}\Largb{Right}\Largb{N}\% multiple values possible\\
+\Lcs{makeRandomNumberList}\Largb{Left}\Largb{Right}\Largb{N} \% no multiple values!\\
+\Lcs{getNumberFromList}\Largb{number}
+\end{BDef}
+
+
+The list of the random numbers is saved in the Lua table \texttt{RandomNumbers}.
+
+
+\section{Examples}
+
+
+\begin{LTXexample}[pos=t]
+\small
+\makeSimpleRandomNumberList{1}{30}{30}% with multiple values (hopefully ;-)
+\multido{\iA=1+1}{30}{\getNumberFromList{\iA}, }
+
+\makeRandomNumberList{1}{30}{30}% without multiple values
+\multido{\iA=1+1}{30}{\getNumberFromList{\iA}, }
+\end{LTXexample}
+
+
+
+The following example uses PSTricks related packages which cannot be run directly
+with Lua\LaTeX. The package \LPack{auto-pst-pdf-lua} will convert the PSTricks stuff
+in the baclground into PDF images which will be included in a second run.
+
+
+\begin{LTXexample}[pos=t]
+\newcounter{RandNo}\setcounter{RandNo}{1}
+\def\n{10} \def\N{\the\numexpr\n*\n}
+\makeRandomNumberList{1}{\N}{\N}
+\begin{pspicture}(\n,\n)
+ \psgrid[subgriddiv=0,gridlabels=0pt]
+ \multido{\rRow=0.5+1.0}{\n}{\multido{\rCol=0.5+1.0}{\n}{%
+ \rput(\rCol,\rRow){\textcolor{randomhsb}{\getNumberFromList{\theRandNo}}}%
+ \stepcounter{RandNo}}}
+\end{pspicture}
+\end{LTXexample}
+
+
+\section{The code}
+
+\lstinputlisting{luarandom.sty}
+
+\printindex
+
+
+\end{document}
Property changes on: trunk/Master/texmf-dist/doc/lualatex/luarandom/luarandom-doc.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/lualatex/luarandom/luarandom.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/luarandom/luarandom.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/luarandom/luarandom.sty 2018-12-15 22:41:11 UTC (rev 49419)
@@ -0,0 +1,76 @@
+% $Id: luarandom.sty 862 2018-12-15 16:25:55Z herbert $
+%%
+%% This is file `luarandom.sty'.
+%%
+%% IMPORTANT NOTICE:
+%%
+%% luarandom Copyright (C) 2019- Herbert Voss <hvoss at tug.org>
+%%
+%% This package may be distributed under the terms of the LaTeX Project
+%% Public License, as described in lppl.txt in the base LaTeX distribution.
+%% Either version 1.3 or, at your option, any later version.
+%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{luarandom}[2018/12/16 v 0.01 package for random numbers]
+\RequirePackage{ifluatex}
+\def\lua at nl{^^J\space\space\space\space}
+\newcommand\lua at PackageError[2]{\PackageError{luarandom}{\lua at nl #1^^J}{#2}}
+\ifluatex\else
+ \lua at PackageError{%
+ "You are not using LuaTeX\app at nl
+ the lua definitions will not be available!}
+ {If you run the source from a GUI then set
+ the compiler "lualatex" in the
+ preferences.}%
+\fi
+
+\RequirePackage{luacode}
+\begin{luacode*}
+RandomNumbers = {}
+
+function allFound(R)
+ local r1 = R[1]
+ local i
+ for i=2,#R do
+ r1 = r1 and R[i]
+ if not r1 then return false end
+ end
+ return true
+end
+
+function makeRandomNumberList(l,r,n)
+ RandomNumbers = {}
+ math.randomseed(os.time())
+ local R = {}
+ local i,j
+ for i=1,n do R[i] = false end
+ repeat
+ local rand = math.random(l,r)
+ if not R[rand] then
+ R[rand] = true
+ RandomNumbers[#RandomNumbers+1] = rand
+ end
+ until allFound(R)
+end
+
+function makeSimpleRandomNumberList(l,r,n)
+ RandomNumbers = {}
+ math.randomseed(os.time()/3)
+ local i
+ for i=1,n do RandomNumbers[#RandomNumbers+1] = math.random(l,r) end
+end
+
+function getRand(i)
+ tex.print(RandomNumbers[i])
+end
+\end{luacode*}
+
+\def\makeRandomNumberList#1#2#3{%
+ \directlua{makeRandomNumberList(#1,#2,#3)}}
+\def\makeSimpleRandomNumberList#1#2#3{%
+ \directlua{makeSimpleRandomNumberList(#1,#2,#3)}}
+\def\getNumberFromList#1{\directlua{getRand(#1)}}
+
+
+\endinput
Property changes on: trunk/Master/texmf-dist/tex/lualatex/luarandom/luarandom.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2018-12-15 01:23:18 UTC (rev 49418)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2018-12-15 22:41:11 UTC (rev 49419)
@@ -415,7 +415,7 @@
lua2dox luabibentry luabidi luacode luahyphenrules
luaindex luainputenc luaintro lualatex-doc lualatex-doc-de
lualatex-math lualatex-truncate lualibs
- luamesh luamplib luaotfload luapackageloader
+ luamesh luamplib luaotfload luapackageloader luarandom
luasseq luatex85 luatexbase luatexja luatexko luatextra
luatodonotes luavlna luaxml
lwarp lxfonts ly1 lyluatex
Modified: trunk/Master/tlpkg/libexec/ctan2tds
===================================================================
--- trunk/Master/tlpkg/libexec/ctan2tds 2018-12-15 01:23:18 UTC (rev 49418)
+++ trunk/Master/tlpkg/libexec/ctan2tds 2018-12-15 22:41:11 UTC (rev 49419)
@@ -708,6 +708,7 @@
'ltxtable', "die 'skipping, use carlisle'",
'lua-visual-debug', "&MAKEflatten",
'luamesh', "&MAKEflatten",
+ 'luarandom', "&MAKEflatten",
'luatex-def', "die 'skipping, replaced by graphics-def'",
'lucida', "die 'skipping, nonfree font'",
'lucida-otf', "die 'skipping, nonfree font'",
Modified: trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc 2018-12-15 01:23:18 UTC (rev 49418)
+++ trunk/Master/tlpkg/tlpsrc/collection-luatex.tlpsrc 2018-12-15 22:41:11 UTC (rev 49419)
@@ -29,6 +29,7 @@
depend luamplib
depend luaotfload
depend luapackageloader
+depend luarandom
depend luatex85
depend luatexbase
depend luatexko
Added: trunk/Master/tlpkg/tlpsrc/luarandom.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list