src/lib/MersenneTwister.js
/**
   * Initializes by an array with array-length
   * @param {number[]} key the array for initializing keys
   * @param {number} length the array for initializing keys
   */
Initializes by an array with array-length
@param {number[]} key the array for initializing keys
@param {number} length the array for initializing keys
Initializes by an array with array - length @param { number [] } key the array for initializing keys @param { number } length the array for initializing keys
initByArray(key, length) {
    let i = 1;
    let j = 0;
    let s;
    this.initGenRand(19650218);
    let k = this[nValue] > length ? this[nValue] : length;
    for (; k; k--) {
      s = this[mtValue][i - 1] ^ (this[mtValue][i - 1] >>> 30);
      this[mtValue][i] = (this[mtValue][i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + (s & 0x0000ffff) * 1664525)) + key[j] + j; 
      this[mtValue][i] >>>= 0; 
      i++;
      j++;
      if (i >= this[nValue]) {
        this[mtValue][0] = this[mtValue][this[nValue] - 1];
        i = 1;
      }
      if (j >= length) {
        j = 0;
      }
    }
    for (k = this[nValue] - 1; k; k--) {
      s = this[mtValue][i - 1] ^ (this[mtValue][i - 1] >>> 30);
      this[mtValue][i] = (this[mtValue][i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941)) - i; 
      this[mtValue][i] >>>= 0; 
      i++;
      if (i >= this[nValue]) {
        this[mtValue][0] = this[mtValue][this[nValue] - 1];
        i = 1;
      }
    }
    this[mtValue][0] = 0x80000000; 
  }
initByArray ( key , length ) { let i = 1 ; let j = 0 ; let s ; this . initGenRand ( 19650218 ) ; let k = this [ nValue ] > length ? this [ nValue ] : length ; for ( ; k ; k -- ) { s = this [ mtValue ] [ i - 1 ] ^ ( this [ mtValue ] [ i - 1 ] >>> 30 ) ; this [ mtValue ] [ i ] = ( this [ mtValue ] [ i ] ^ ( ( ( ( ( s & 0xffff0000 ) >>> 16 ) * 1664525 ) << 16 ) + ( s & 0x0000ffff ) * 1664525 ) ) + key [ j ] + j ; this [ mtValue ] [ i ] >>>= 0 ; i ++ ; j ++ ; if ( i >= this [ nValue ] ) { this [ mtValue ] [ 0 ] = this [ mtValue ] [ this [ nValue ] - 1 ] ; i = 1 ; } if ( j >= length ) { j = 0 ; } } for ( k = this [ nValue ] - 1 ; k ; k -- ) { s = this [ mtValue ] [ i - 1 ] ^ ( this [ mtValue ] [ i - 1 ] >>> 30 ) ; this [ mtValue ] [ i ] = ( this [ mtValue ] [ i ] ^ ( ( ( ( ( s & 0xffff0000 ) >>> 16 ) * 1566083941 ) << 16 ) + ( s & 0x0000ffff ) * 1566083941 ) ) - i ; this [ mtValue ] [ i ] >>>= 0 ; i ++ ; if ( i >= this [ nValue ] ) { this [ mtValue ] [ 0 ] = this [ mtValue ] [ this [ nValue ] - 1 ] ; i = 1 ; } } this [ mtValue ] [ 0 ] = 0x80000000 ; }
Initializes by an array with array-length
 @param {number[]} key the array for initializing keys
 @param {number} length the array for initializing keys
Initializes by an array with array - length @param { number [] } key the array for initializing keys @param { number } length the array for initializing keys
/* non linear */ /* for WORDSIZE > 32 machines */ /* non linear */ /* for WORDSIZE > 32 machines */ /* MSB is 1; assuring non-zero initial array */