summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mlib-run.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-01-17 18:05:46 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-01-17 18:05:46 +0100
commit0cfeab235554eeee0dddd6c3f44d3939ab490ff1 (patch)
treefed70e9a3332741e5294a01197c716dff8556506 /tex/context/base/mkiv/mlib-run.lua
parent72d161c0a522fd92f32edd3588fa126c453f4a3d (diff)
downloadcontext-0cfeab235554eeee0dddd6c3f44d3939ab490ff1.tar.gz
2017-01-17 17:43:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-run.lua')
-rw-r--r--tex/context/base/mkiv/mlib-run.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 0ef80892a..bc8cf4dbd 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -187,6 +187,7 @@ local f_preamble = formatters [ [[
boolean mplib ; mplib := true ;
let dump = endinput ;
input "%s" ;
+ randomseed:=%s;
]] ]
local methods = {
@@ -219,8 +220,18 @@ function metapost.maketext(s,mode)
end
end
+local seed = nil
+
function metapost.load(name,method)
starttiming(mplib)
+ if not seed then
+ seed = job.getrandomseed()
+ if seed <= 1 then
+ seed = seed % 1000
+ elseif seed > 4095 then
+ seed = seed % 4096
+ end
+ end
method = method and methods[method] or "scaled"
local mpx = new_instance {
ini_version = true,
@@ -235,7 +246,7 @@ function metapost.load(name,method)
if not mpx then
result = { status = 99, error = "out of memory"}
else
- result = mpx:execute(f_preamble(file.addsuffix(name,"mp"))) -- addsuffix is redundant
+ result = mpx:execute(f_preamble(file.addsuffix(name,"mp"),seed)) -- addsuffix is redundant
end
stoptiming(mplib)
metapost.reporterror(result)