Set seed to null by default

This commit is contained in:
pyoor 2018-09-04 13:34:07 -04:00
parent 4fda7284c6
commit d09037b37c

View file

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