public MersenneTwisterRNG(final byte[] seed){
  if (seed == null || seed.length != SEED_SIZE_BYTES) {
    throw new IllegalArgumentException("Mersenne Twister RNG requires a 128-bit (16-byte) seed.");
  }
  this.seed=seed.clone();
  final int[] seedInts=convertBytesToInts(this.seed);
  mt[0]=BOOTSTRAP_SEED;
  for (mtIndex=1; mtIndex < N; mtIndex++) {
    mt[mtIndex]=BOOTSTRAP_FACTOR * (mt[mtIndex - 1] ^ mt[mtIndex - 1] >>> 30) + mtIndex;
  }
  int i=1;
  int j=0;
  for (int k=Math.max(N,seedInts.length); k > 0; k--) {
    mt[i]=(mt[i] ^ (mt[i - 1] ^ mt[i - 1] >>> 30) * SEED_FACTOR1) + seedInts[j] + j;
    i++;
    j++;
    if (i >= N) {
      mt[0]=mt[N - 1];
      i=1;
    }
    if (j >= seedInts.length) {
      j=0;
    }
  }
  for (int k=N - 1; k > 0; k--) {
    mt[i]=(mt[i] ^ (mt[i - 1] ^ mt[i - 1] >>> 30) * SEED_FACTOR2) - i;
    i++;
    if (i >= N) {
      mt[0]=mt[N - 1];
      i=1;
    }
  }
  mt[0]=UPPER_MASK;
}

public MersenneTwisterRNG ( final byte [ ] seed ) { if ( seed == null || seed . length != SEED_SIZE_BYTES ) { throw new IllegalArgumentException ( "Mersenne Twister RNG requires a 128-bit (16-byte) seed." ) ; } this . seed = seed . clone ( ) ; final int [ ] seedInts = convertBytesToInts ( this . seed ) ; mt [ 0 ] = BOOTSTRAP_SEED ; for ( mtIndex = 1 ; mtIndex < N ; mtIndex ++ ) { mt [ mtIndex ] = BOOTSTRAP_FACTOR * ( mt [ mtIndex - 1 ] ^ mt [ mtIndex - 1 ] > > > 30 ) + mtIndex ; } int i = 1 ; int j = 0 ; for ( int k = Math . max ( N , seedInts . length ) ; k > 0 ; k -- ) { mt [ i ] = ( mt [ i ] ^ ( mt [ i - 1 ] ^ mt [ i - 1 ] > > > 30 ) * SEED_FACTOR1 ) + seedInts [ j ] + j ; i ++ ; j ++ ; if ( i >= N ) { mt [ 0 ] = mt [ N - 1 ] ; i = 1 ; } if ( j >= seedInts . length ) { j = 0 ; } } for ( int k = N - 1 ; k > 0 ; k -- ) { mt [ i ] = ( mt [ i ] ^ ( mt [ i - 1 ] ^ mt [ i - 1 ] > > > 30 ) * SEED_FACTOR2 ) - i ; i ++ ; if ( i >= N ) { mt [ 0 ] = mt [ N - 1 ] ; i = 1 ; } } mt [ 0 ] = UPPER_MASK ; }
creates an rng and seeds it with the specified seed data .
