From 9cb623c096c277bc94e10273961f0fbcbfac2e44 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Sun, 6 Aug 2017 16:56:58 -0700 Subject: [PATCH] Expose random seed function to scripts --- lib/sandbox.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/sandbox.js b/lib/sandbox.js index 82149cf..571feee 100644 --- a/lib/sandbox.js +++ b/lib/sandbox.js @@ -54,11 +54,15 @@ class SandboxDate { function random() { if (!state.rng) - state.rng = seedrandom(state.sessionContext.timestamp); + state.rng = seedrandom(state.sessionContext.deviceId); return state.rng(); } +random.seed = function(s) { + state.rng = seedrandom(s); +} + class ParameterWrapper { constructor(path, attributes, unpacked, unpackedRevision) {