diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-06 21:58:15 +0000 |
commit | 974640d66e61e81cb197ad96fdff7b08343e4c5a (patch) | |
tree | 2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua | |
parent | b4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff) |
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua b/Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua index 1a2d10bea72..7946370d727 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/supp-ran.lua @@ -53,6 +53,9 @@ end math.setrandomseedi = setrandomseedi local function getrandomnumber(min,max) + if min > max then + min, max = max, min + end last = random(min,max) if trace_details then report_system("number %s",last) @@ -80,7 +83,8 @@ end -- maybe stack local function pushrandomseed() - insert(stack,last) + -- insert(stack,last) -- doesn't work okay + insert(stack,randomseed(last) or last) if trace_random or trace_details then report_system("pushing seed %s",last) end @@ -132,6 +136,8 @@ utilities.randomizer = { reuseseed = reuserandomseed, popseed = poprandomseed, get = getrandom, + -- the original, only for testing + -- mathrandom = random, } -- todo: also open up in utilities.randomizer.* @@ -139,10 +145,9 @@ utilities.randomizer = { implement { name = "getrandomnumber", actions = { getrandomnumber, context }, arguments = { "integer", "integer" } } implement { name = "getrandomdimen", actions = { getrandomnumber, context }, arguments = { "dimen", "dimen" } } implement { name = "getrandomfloat", actions = { getrandomnumber, context }, arguments = { "number", "number" } } ---------- { name = "getmprandomnumber", actions = { getmprandomnumber, context } } -implement { name = "setrandomseed", actions = { setrandomseed }, arguments = { "integer" } } -implement { name = "getrandomseed", actions = { getrandomseed, context } } -implement { name = "pushrandomseed", actions = { pushrandomseed } } -implement { name = "poprandomseed", actions = { poprandomseed } } -implement { name = "reuserandomseed", actions = { reuserandomseed } } +implement { name = "getrandomseed", actions = { getrandomseed, context } } +implement { name = "setrandomseed", actions = setrandomseed, arguments = "integer" } +implement { name = "pushrandomseed", actions = pushrandomseed, public = true, } +implement { name = "poprandomseed", actions = poprandomseed, public = true, } +implement { name = "reuserandomseed", actions = reuserandomseed, public = true, } |