From 23efa3df7fb3e86df98180355102794a562e7d17 Mon Sep 17 00:00:00 2001 From: Christoph Diehl Date: Thu, 8 Jun 2017 04:12:49 +0200 Subject: [PATCH] Let random seed be a property --- lib/random/random.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/random/random.js b/lib/random/random.js index ed6d5f0..2adaded 100644 --- a/lib/random/random.js +++ b/lib/random/random.js @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var random = { // eslint-disable-line no-unused-vars + seed: null, twister: null, /** @@ -11,10 +12,10 @@ var random = { // eslint-disable-line no-unused-vars */ init: function (seed) { if (seed === null || seed === undefined) { - seed = new Date().getTime() + this.seed = new Date().getTime() } this.twister = new MersenneTwister() - this.twister.seed(seed) + this.twister.seed(this.seed) }, number: function (limit) { // Returns an integer in [0, limit). Uniform distribution.