public static synchronized byte[] generateNonce(int length) throws NoSuchAlgorithmException {
  if (random == null) {
    random=SecureRandom.getInstance("SHA1PRNG");
  }
  byte[] temp=new byte[length];
  random.nextBytes(temp);
  return temp;
}

public static synchronized byte [ ] generateNonce ( int length ) throws NoSuchAlgorithmException { if ( random == null ) { random = SecureRandom . getInstance ( "SHA1PRNG" ) ; } byte [ ] temp = new byte [ length ] ; random . nextBytes ( temp ) ; return temp ; }
generate a nonce of the given length using the sha1prng algorithm . the securerandom instance that backs this method is cached for efficiency .
