texlive[54518] Master/texmf-dist: pst-tools (24mar20)

commits+karl at tug.org commits+karl at tug.org
Tue Mar 24 21:51:28 CET 2020


Revision: 54518
          http://tug.org/svn/texlive?view=revision&revision=54518
Author:   karl
Date:     2020-03-24 21:51:28 +0100 (Tue, 24 Mar 2020)
Log Message:
-----------
pst-tools (24mar20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/pst-tools/Changes
    trunk/Master/texmf-dist/doc/generic/pst-tools/README
    trunk/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdf
    trunk/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex
    trunk/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex
    trunk/Master/texmf-dist/tex/latex/pst-tools/pst-tools.sty

Modified: trunk/Master/texmf-dist/doc/generic/pst-tools/Changes
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-tools/Changes	2020-03-24 20:50:55 UTC (rev 54517)
+++ trunk/Master/texmf-dist/doc/generic/pst-tools/Changes	2020-03-24 20:51:28 UTC (rev 54518)
@@ -1,4 +1,6 @@
 ..... pst-tools.tex
+0.10  2020-03-24  - added the random macros from random.tex which is no more
+                    on TeXLive
 0.09b 2017-12-03  - modified pro file
                   - added PostScript function list to the documentation
 0.09a 2017-11-29  - modified pro file
@@ -20,6 +22,7 @@
       2012-01-01  first version
 
 
+
 ---- pst-tools.pro
 0.06  2017-11-30  - added function concatarray 
 0.05  2017-11-29  - added function concatstrings 

Modified: trunk/Master/texmf-dist/doc/generic/pst-tools/README
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-tools/README	2020-03-24 20:50:55 UTC (rev 54517)
+++ trunk/Master/texmf-dist/doc/generic/pst-tools/README	2020-03-24 20:51:28 UTC (rev 54518)
@@ -23,3 +23,4 @@
 
 
 %% $Id: README 286 2010-02-11 09:40:41Z herbert $
+hvoss at tug.org
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex	2020-03-24 20:50:55 UTC (rev 54517)
+++ trunk/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex	2020-03-24 20:51:28 UTC (rev 54518)
@@ -1,6 +1,6 @@
-%% $Id: pst-tools-doc.tex 675 2017-12-03 08:39:12Z herbert $
+%% $Id: pst-tools-doc.tex 1163 2020-03-24 09:47:58Z herbert $
 \documentclass[11pt,english,BCOR=10mm,DIV=13,toc=bibliography,parskip=false,
-   headings=small, headinclude=false,footinclude=false,oneside]{pst-doc}
+   headings=small,headinclude=false,footinclude=false,oneside]{pst-doc}
 \usepackage[utf8]{inputenc}
 \usepackage{pst-tools}
 \let\pstToolsFV\fileversion
@@ -24,7 +24,7 @@
 
 \begin{abstract}
 This package defines some tools which are useful for all packages not only the PSTricks like packages.
-
+Since the version 0.10 it includes the macros from \texttt{random.tex}.
 \vfill
 \noindent
 Thanks to:  
@@ -188,7 +188,7 @@
 
 
 \begin{lstlisting}
-\psRegisterList{Color}{violet,blue,green,red}% defines macro \Color
+\psRegisterList{Color}{yellow,blue,green,red}% defines macro \Color
 \begin{pspicture}(-7,-4.5)(7,5.5)
 \psaxes{->}(0,0)(-6.5,-4.5)(6.75,5)
 \psset{plotpoints=400,algebraic,linewidth=1pt,fillstyle=solid,opacity=0.4}
@@ -201,7 +201,7 @@
 \end{pspicture}
 \end{lstlisting}
 
-\psRegisterList{Color}{violet,blue,green,red}% defines macro \Color
+\psRegisterList{Color}{yellow,blue,green,red}% defines macro \Color
 \begin{pspicture}(-7,-4.5)(7,5.5)
 \psaxes{->}(0,0)(-6.5,-4.5)(6.75,5)
 \psset{plotpoints=400,algebraic,linewidth=1pt,fillstyle=solid,opacity=0.4}
@@ -213,6 +213,58 @@
 \end{pspicture}
 
 
+
+\section{Random numbers}
+The file \LFile{random.tex} from Donald Arseneau is no more part of CTAN due to a missing licence statement. 
+\LFile{pst-tools} at version 0.10 includes the code. The documentation was inside the package otself:
+
+Random integers are generated in the range 1 to 2147483646 by the
+macro \Lcs{nextrandom}.  The result is returned in the counter \Lcs{randomi}.
+Do not change \Lcs{randomi} except, perhaps, to initialize it at some
+random value.  If you do not initialize it, it will be initialized
+using the time and date.  (This is a sparse initialization, giving
+fewer than a million different starting values, but you should use
+other sources of numbers if they are available--just remember that
+most of the numbers available to TeX are not at all random.)
+
+The \Lcs{nextrandom} command is not very useful by itself, unless you
+have exactly 2147483646 things to choose from.  Much more useful
+is the \Lcs{setrannum} command which sets a given counter to a random
+value within a specified range.  There are three parameters:
+
+\Lcs{setrannum\{<counter>\}\{<minimum>\}\{<maximum>\}}  
+
+For example, to
+simulate a die-roll: 
+
+\verb|\setrannum{\die}{1}{6}| \verb|\ifcase\die...| .
+
+If you need random numbers that are not integers, you will have to
+use dimen registers and \Lcs{setrandimen}.  For example, to set a random
+page width: 
+
+\Lcs{setrandimen} \Lcs{hsize\{3in\}\{6.5in\}}
+
+ The »\Lcs{pointless}« macro
+will remove the »pt« that TeX gives so you can use the dimensions
+as pure `real' numbers.  In that case, specify the range in pt units.
+For example,
+
+  \verb|\setrandimen\answer{2.71828pt}{3.14159pt}|
+
+  The answer is \verb|\pointless\answer|.
+
+The random number generator is the one by Lewis, Goodman, and Miller
+(1969) and used as \texttt{ran0} in »Numerical Recipies« using Schrage's
+method for avoiding overflows.  The multiplier is $16807 (7^5)$, the
+added constant is 0, and the modulus is $2147483647 (2^{31}-1)$.  The
+range of integers generated is $1 - 2147483646$.  A smaller range would
+reduce the complexity of the macros a bit, but not much--most of the
+code deals with initialization and type-conversion.  On the other hand,
+the large range may be wasted due to the sparse seed initialization.
+
+
+
 \section{List of the defined PostScript functions}
 
 \footnotesize

Modified: trunk/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex	2020-03-24 20:50:55 UTC (rev 54517)
+++ trunk/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex	2020-03-24 20:51:28 UTC (rev 54518)
@@ -1,4 +1,4 @@
-%% $Id: pst-tools.tex 674 2017-12-02 22:04:53Z herbert $
+%% $Id: pst-tools.tex 1163 2020-03-24 09:47:58Z herbert $
 %%
 %% This is file `pst-tools.tex',
 %%
@@ -26,8 +26,8 @@
 % interface to the `xkeyval' package
 \pst at addfams{pst-tools}
 %
-\def\fileversion{0.09b}
-\def\filedate{2017/12/03}
+\def\fileversion{0.10}
+\def\filedate{2020/03/24}
 \message{`PST-tools' v\fileversion, \filedate\space (hv)}
 %
 \define at key[psset]{pst-tools}{decimalSeparator}[.]{\def\psk at decimalSeparator{#1}}%
@@ -131,7 +131,101 @@
     \advance\pst at cnto by 1
   }%
 }
+% RANDOM.TEX       v.1   (Donald Arseneau)
+% Generating "random" numbers in TeX. 
+%
+% Random integers are generated in the range 1 to 2147483646 by the
+% macro \nextrandom.  The result is returned in the counter \randomi.
+% Do not change \randomi except, perhaps, to initialize it at some
+% random value.  If you do not initialize it, it will be initialized
+% using the time and date.  (This is a sparse initialization, giving
+% fewer than a million different starting values, but you should use
+% other sources of numbers if they are available--just remember that
+% most of the numbers available to TeX are not at all random.)
+%
+% The \nextrandom command is not very useful by itself, unless you
+% have exactly 2147483646 things to choose from.  Much more useful
+% is the \setrannum command which sets a given counter to a random
+% value within a specified range.  There are three parameters:
+% \setrannum {<counter>} {<minimum>} {<maximum>}.  For example, to
+% simulate a die-roll: \setrannum{\die}{1}{6} \ifcase\die... .
+%
+% If you need random numbers that are not integers, you will have to
+% use dimen registers and \setrandimen.  For example, to set a random
+% page width: \setrandimen \hsize{3in}{6.5in}.  The "\pointless" macro
+% will remove the "pt" that TeX gives so you can use the dimensions
+% as pure `real' numbers.  In that case, specify the range in pt units.
+% For example,
+%   \setrandimen\answer{2.71828pt}{3.14159pt}
+%   The answer is \pointless\answer.
+%
+% The random number generator is the one by Lewis, Goodman, and Miller
+% (1969) and used as "ran0" in "Numerical Recipies" using Schrage's
+% method for avoiding overflows.  The multiplier is 16807 (7^5), the
+% added constant is 0, and the modulus is 2147483647 (2^{31}-1).  The
+% range of integers generated is 1 - 2147483646.  A smaller range would
+% reduce the complexity of the macros a bit, but not much--most of the
+% code deals with initialization and type-conversion.  On the other hand,
+% the large range may be wasted due to the sparse seed initialization.
 
+\newcount\randomi % the random number seed (while executing)
+\global\randomi\catcode`\@  % scratch variable during definitions
+\catcode`\@=11
+
+\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
+ \fi
+ \count at ii\randomi
+ \divide\count at ii 127773 % modulus = multiplier * 127773 + 2836
+ \count@\count at ii
+ \multiply\count at ii 127773
+ \global\advance\randomi-\count at 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
+}
+
+\countdef\count at ii=2 % use only in boxes!
+\ifx\@tempcnta\undefined \csname newcount\endcsname \@tempcnta \fi
+\ifx\@tempcntb\undefined \csname newcount\endcsname \@tempcntb \fi
+
+\def\setrannum#1#2#3{% count register, minimum, maximum
+ \@tempcnta#3\advance\@tempcnta-#2\advance\@tempcnta\@ne
+ \@tempcntb 2147483645 %  =  m - 2  =  2^{31} - 3
+ \divide\@tempcntb\@tempcnta
+ \getr at nval
+ \advance\ranval#2\relax
+ #1\ranval
+}
+
+\def\setrandim#1#2#3{% dimen register, minimum length, maximum length
+ \dimen@#2\dimen at ii#3\relax
+ \setrannum\ranval\dimen@\dimen at ii
+ #1\ranval sp\relax
+}
+
+\def\getr at nval{% The values in \@tempcnta and \@tempcntb are parameters
+ \nextrandom
+ \ranval\randomi \advance\ranval\m at ne \divide\ranval\@tempcntb
+ \ifnum\ranval<\@tempcnta\else \expandafter\getr at nval \fi
+}
+
+\def\pointless{\expandafter\PoinTless\the}
+{\catcode`p=12 \catcode`t=12 
+\gdef\PoinTless#1pt{#1}}
+
+\catcode`\@=\randomi
+\global\randomi=0
+\newcount\ranval
+
 \catcode`\@=\PstAtCode\relax
 %
 %% END: pst-tools.tex

Modified: trunk/Master/texmf-dist/tex/latex/pst-tools/pst-tools.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pst-tools/pst-tools.sty	2020-03-24 20:50:55 UTC (rev 54517)
+++ trunk/Master/texmf-dist/tex/latex/pst-tools/pst-tools.sty	2020-03-24 20:51:28 UTC (rev 54518)
@@ -9,4 +9,4 @@
      \@addtofilelist{pst-tools.pro}}{}%
 
 \endinput
-%% $Id: pst-tools.sty 606 2017-10-02 17:34:18Z herbert $
+%% $Id: pst-tools.sty 680 2017-12-05 12:22:55Z herbert $



More information about the tex-live-commits mailing list.