Code example for SecureRandom

Methods: nextBytes

0
			rv[i] = (byte) (b1[i] ^ b2[i]);
		return rv;
	} 
 
	static public void randomBytes(SecureRandom r, byte[] buf) {
		r.nextBytes(buf);
	} 
 
	static public void randomBytes(SecureRandom r, byte[] buf, int from, int len) {
		randomBytesSlowNextInt(r, buf, from, len);
	} 
 
	/** Fill specified range of byte array with random data. */ 
	static private void randomBytesSlowNextInt(Random r, byte[] buf, int from, int len) {
	   if (from == 0 && len == buf.length) {
		   r.nextBytes(buf);
		   return; 
	   } 
	   byte [] tmp = new byte[len];
	   r.nextBytes(tmp);
Stop searching for code, let great code find you!  Add Codota to your java IDE