public final void testSetSeedbyteArray03() throws NoSuchFieldException, SecurityException, IllegalAccessException {
  byte[] seed=new byte[LENGTH];
  byte[] bytes1;
  byte[] bytes2;
  for (int i=0; i < seed.length; i++) {
    seed[i]=(byte)i;
  }
  for (int i=0; i < LENGTH; i++) {
    bytes1=new byte[i];
    bytes2=new byte[i];
    sr.setSeed(seed);
    sr.setSeed(new byte[0]);
    sr.nextBytes(bytes1);
    sr2.setSeed(seed);
    sr2.nextBytes(bytes2);
    for (int j=0; j < bytes1.length; j++) {
      assertEquals("bytes1[j] != bytes2[j] :: j=" + j,bytes1[j],bytes2[j]);
    }
  }
  for (int i=1; i < LENGTH; i++) {
    bytes1=new byte[i];
    bytes2=new byte[i];
    sr.setSeed(seed);
    sr.nextBytes(bytes1);
    sr.setSeed(new byte[0]);
    sr.nextBytes(bytes2);
    boolean b=true;
    for (int j=0; j < bytes1.length; j++) {
      b&=bytes1[j] == bytes2[j];
    }
    assertFalse("sequences are equal i=" + i,b);
  }
}

public final void testSetSeedbyteArray03 ( ) throws NoSuchFieldException , SecurityException , IllegalAccessException { byte [ ] seed = new byte [ LENGTH ] ; byte [ ] bytes1 ; byte [ ] bytes2 ; for ( int i = 0 ; i < seed . length ; i ++ ) { seed [ i ] = ( byte ) i ; } for ( int i = 0 ; i < LENGTH ; i ++ ) { bytes1 = new byte [ i ] ; bytes2 = new byte [ i ] ; sr . setSeed ( seed ) ; sr . setSeed ( new byte [ 0 ] ) ; sr . nextBytes ( bytes1 ) ; sr2 . setSeed ( seed ) ; sr2 . nextBytes ( bytes2 ) ; for ( int j = 0 ; j < bytes1 . length ; j ++ ) { assertEquals ( "bytes1[j] != bytes2[j] :: j=" + j , bytes1 [ j ] , bytes2 [ j ] ) ; } } for ( int i = 1 ; i < LENGTH ; i ++ ) { bytes1 = new byte [ i ] ; bytes2 = new byte [ i ] ; sr . setSeed ( seed ) ; sr . nextBytes ( bytes1 ) ; sr . setSeed ( new byte [ 0 ] ) ; sr . nextBytes ( bytes2 ) ; boolean b = true ; for ( int j = 0 ; j < bytes1 . length ; j ++ ) { b &= bytes1 [ j ] == bytes2 [ j ] ; } assertFalse ( "sequences are equal i=" + i , b ) ; } }
test against the " void setseed ( byte [ ] ) " method ; it checks out that the " byte [ 0 ] " argument has no effect ; there are two testcases : - if one of two securerandom objects supplied with the same seed is additionally supplied with such array , " nextbytes ( . . ) " of both objects return the same bytes ; - two byte arrays returned by " nextbytes ( . . ) " in following sequence nextbytes ( . . ) ; setseed ( new byte [ 0 ] ) ; nextbytes ( . . ) ; don ' t contain the same byte sequencies .
