Set seed to null by default
This commit is contained in:
parent
4fda7284c6
commit
d09037b37c
1 changed files with 5 additions and 2 deletions
|
@ -8,9 +8,12 @@ const logger = require('../logging')
|
||||||
class random {
|
class random {
|
||||||
/**
|
/**
|
||||||
* Must be called before any other methods can be called to initialize MersenneTwister
|
* 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 = new MersenneTwister()
|
||||||
random.twister.seed(seed)
|
random.twister.seed(seed)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue