private static byte [ ] secureRandom ( int size ) { if ( size <= 0 ) throw new IllegalArgumentException ( "Size cannot be zero or less than zero." ) ; SecureRandom secureRandom = new SecureRandom ( ) ; byte [ ] bytes = new byte [ size ] ; secureRandom . nextBytes ( bytes ) ; return bytes ; }
Secure random bytes of size in bytes