public static String generateRandomString ( int nbytes ) { byte [ ] salt = new byte [ nbytes ] ; Random r = new SecureRandom ( ) ; r . nextBytes ( salt ) ; return bytesToHex ( salt ) ; }
Generate a random string with a certain entropy .