Merge pull request #1470 from arrnavvv/master

String to StringBuilder in Others/PasswordGen.java
This commit is contained in:
Du Yuanchao 2020-09-18 14:17:27 +08:00 committed by GitHub
commit 88ac7cfbb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,13 +35,13 @@ class PasswordGen {
// Inbuilt method to randomly shuffle a elements of a list
Collections.shuffle(letters);
String password = "";
StringBuilder password = new StringBuilder();
// Note that size of the password is also random
for (int i = random.nextInt(max_length - min_length) + min_length; i > 0; --i) {
password += letters.get(random.nextInt(letters.size()));
password .append( letters.get(random.nextInt(letters.size())));
}
return password;
return password.toString();
}
}