Code example for SecureRandom

Methods: setSeed

0
	 
	/* 
	 * Class under test for void setSeed(byte[]) 
	 */ 
	public final void testSetSeedbyteArray() { 
		SecureRandom sr = new SecureRandom();
 
		//Not specified behavior: throws NullPointerException if bytes is null 
		try { 
			sr.setSeed(null);
		} catch (NullPointerException e) {	
		} 
		 
		byte[] seed = {1,2,3,4};
		sr.setSeed(seed);
		 
		byte[] seed1 = {1,2,3,4, -2, 100, 9, 111};
		sr.setSeed(seed1);
	} 
 
	public final void testGetSeed() { 
		byte[] seed = SecureRandom.getSeed(5);
		new SecureRandom(seed).nextBytes(new byte[20]);