Set default seed value

This commit is contained in:
pyoor 2018-08-27 18:57:27 -04:00
parent 7252e9e2b5
commit 942d9d89ba

View file

@ -8,13 +8,9 @@ const {logger} = require('../logging')
class random {
/**
* Must be called before any other methods can be called to initialize MersenneTwister
* @param {number|null|undefined} seed - Value to initialize MersenneTwister
* @param {number} seed - Value to initialize MersenneTwister
*/
static init (seed) {
if (seed === null || seed === undefined) {
random.seed = new Date().getTime()
}
static init (seed = new Date().getTime()) {
random.twister = new MersenneTwister()
random.twister.seed(random.seed)
}