Set default seed value
This commit is contained in:
parent
7252e9e2b5
commit
942d9d89ba
1 changed files with 2 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue