diff options
author | Hans Hagen <pragma@wxs.nl> | 1998-04-15 00:00:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 1998-04-15 00:00:00 +0200 |
commit | f7ce2124ddf34c4a7c785e1500003921d70118ba (patch) | |
tree | 35d818611773ecd034e23a0e4079ba0a994c6887 /tex/context/base/thrd-ran.tex | |
parent | 5f54d546a687e0615f87a117c5950b78ef346af7 (diff) | |
download | context-f7ce2124ddf34c4a7c785e1500003921d70118ba.tar.gz |
stable 1998.04.15
Diffstat (limited to 'tex/context/base/thrd-ran.tex')
-rw-r--r-- | tex/context/base/thrd-ran.tex | 141 |
1 files changed, 71 insertions, 70 deletions
diff --git a/tex/context/base/thrd-ran.tex b/tex/context/base/thrd-ran.tex index db0b5f650..b26e4594a 100644 --- a/tex/context/base/thrd-ran.tex +++ b/tex/context/base/thrd-ran.tex @@ -1,70 +1,71 @@ -%D \module -%D [ file=thrd-ran, -%D version=1998.01.21, -%D title=\CONTEXT\ Support Macros, -%D subtitle=Random Number Generation, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. Non||commercial use is -%C granted. - -\writestatus{loading}{Third Party Macros / Random Number Generation} - -%D \macros -%D {getrandomcount, getrandomdimen, -%D getrandomfloat, getrandomnumber} -%D -%D This module load Donald Arseneau's generic file -%D \type{random.tex}. A small shell is needed because we -%D redefine some \TEX\ primitives. We also use different names -%D for the two generators and add an extra one. -%D -%D \starttypen -%D \getrandomcount \countregister {minimum} {maximum} -%D \getrandomdimen \dimenregister {minimum} {maximum} -%D \getrandomnumber \macroname {minimum} {maximum} -%D \getrandomfloat \macroname {minimum} {maximum} -%D \stoptypen -%D -%D Of course the file \type{random.tex} needs to be present. - -\readfile{random.tex} - {\writestatus{loading}{Donald Arseneau's 'random.tex' (found)}} - {\writestatus{loading}{Donald Arseneau's 'random.tex' (not found)}} - -\ifx\nextrandom\undefined - - \def\setrannum#1#2#3{#1=1 } - \def\setrandim#1#2#3{#1=1pt} - -\else - - \let\normalnextrandom=\nextrandom - - \def\nextrandom% - {\bgroup - \let\time =\normaltime - \let\day =\normalday - \let\month=\normalmonth - \let\year =\normalyear - \normalnextrandom - \global\let\nextrandom=\normalnextrandom - \egroup} - -\fi - -\let\getrandomcount = \setrannum -\let\getrandomdimen = \setrandim - -\def\getrandomnumber#1#2#3% - {\getrandomcount{\scratchcounter}{#2}{#3}% - \edef#1{\the\scratchcounter}} - -\def\getrandomfloat#1#2#3% - {\getrandomdimen{\scratchdimen}{#2pt}{#3pt}% - \edef#1{\withoutpt\the\scratchdimen}} - -\endinput +%D \module
+%D [ file=thrd-ran,
+%D version=1998.01.21,
+%D title=\CONTEXT\ Support Macros,
+%D subtitle=Random Number Generation,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. Non||commercial use is
+%C granted.
+
+\writestatus{loading}{Third Party Macros / Random Number Generation}
+
+%D \macros
+%D {getrandomcount, getrandomdimen,
+%D getrandomfloat, getrandomnumber}
+%D
+%D This module load Donald Arseneau's generic file
+%D \type{random.tex}. A small shell is needed because we
+%D redefine some \TEX\ primitives. We also use different names
+%D for the two generators and add an extra one.
+%D
+%D \starttypen
+%D \getrandomcount \countregister {minimum} {maximum}
+%D \getrandomdimen \dimenregister {minimum} {maximum}
+%D \getrandomnumber \macroname {minimum} {maximum}
+%D \getrandomfloat \macroname {minimum} {maximum}
+%D \stoptypen
+%D
+%D Of course the file \type{random.tex} needs to be present.
+
+\readfile{random.tex}
+ {\writestatus{loading}{Donald Arseneau's 'random.tex' (found)}}
+ {\writestatus{loading}{Donald Arseneau's 'random.tex' (not found)}}
+
+\ifx\nextrandom\undefined
+
+ \def\setrannum#1#2#3{#1=1 }
+ \def\setrandim#1#2#3{#1=1pt}
+
+\else
+
+ \let\normalnextrandom=\nextrandom
+
+ \def\nextrandom%
+ {\bgroup
+ \let\time =\normaltime
+ \let\day =\normalday
+ \let\month=\normalmonth
+ \let\year =\normalyear
+ \normalnextrandom
+ \global\let\nextrandom=\normalnextrandom
+ \egroup}
+
+\fi
+
+\let\getrandomcount = \setrannum
+\let\getrandomdimen = \setrandim
+
+\def\getrandomnumber#1#2#3%
+ {\getrandomcount{\scratchcounter}{#2}{#3}%
+ \edef#1{\the\scratchcounter}}
+
+\def\getrandomfloat#1#2#3%
+ {\getrandomdimen{\scratchdimen}{#2pt}{#3pt}%
+ \edef#1{\withoutpt\the\scratchdimen}}
+
+\endinput
+
\ No newline at end of file |