supp-ran.mkiv /size: 1634 b    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=supp-ran,
3
%D version=2008-10-31,
4
%D title=\CONTEXT\ Support Macros,
5
%D subtitle=Random Number Generation,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
\writestatus
{
loading
}{
ConTeXt
Support
Macros
/
Random
Number
Generation
}
15 16
%D This module is downward compatible in the sense that we've kept
17
%D the user interface (which uses intermediate variables).
18 19
\registerctxluafile
{
supp
-
ran
}{}
20 21
\unprotect
22 23
\unexpanded
\def
\getrandomcount
#
1
#
2
#
3
{
#
1
=
\clf_getrandomnumber
\numexpr
#
2
\relax\numexpr
#
3
\relax\relax
}
24
\unexpanded
\def
\getrandomdimen
#
1
#
2
#
3
{
#
1
=
\clf_getrandomdimen
\dimexpr
#
2
\relax\dimexpr
#
3
\relax
\scaledpoint
\relax
}
25
\unexpanded
\def
\getrandomnumber
#
1
#
2
#
3
{
\edef
#
1
{
\clf_getrandomnumber
\numexpr
#
2
\relax\numexpr
#
3
\relax
}}
26
\unexpanded
\def
\getrandomfloat
#
1
#
2
#
3
{
\edef
#
1
{
\clf_getrandomfloat
\dimexpr
#
2
\relax\dimexpr
#
3
\relax
}}
27
\unexpanded
\def
\setrandomseed
#
1
{
\clf_setrandomseed
\numexpr
#
1
\relax
}
28
\unexpanded
\def
\getrandomseed
#
1
{
\edef
#
1
{
\clf_getrandomseed
}}
29
\unexpanded
\def
\pushrandomseed
{
\clf_pushrandomseed
}
30
\unexpanded
\def
\poprandomseed
{
\clf_poprandomseed
}
31
\unexpanded
\def
\reuserandomseed
{
\clf_reuserandomseed
}
% within push/pop
32 33
\let
\freezerandomseed
\pushrandomseed
34
\let
\defrostrandomseed
\poprandomseed
35 36
\def
\randomnumber
#
1
#
2
{
\clf_getrandomnumber
\numexpr
#
1
\relax\numexpr
#
2
\relax
}
37
\let
\mprandomnumber
\clf_getmprandomnumber
38 39
\protect
\endinput
40