Skip to content

Commit ebdf7be

Browse files
authored
Update PasswordGen.java
1 parent 0646f5e commit ebdf7be

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Others/PasswordGen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ static String generatePassword(int min_length, int max_length) {
3535

3636
// Inbuilt method to randomly shuffle a elements of a list
3737
Collections.shuffle(letters);
38-
String password = "";
38+
StringBuilder password = new StringBuilder();
3939

4040
// Note that size of the password is also random
4141
for (int i = random.nextInt(max_length - min_length) + min_length; i > 0; --i) {
42-
password += letters.get(random.nextInt(letters.size()));
42+
password .append( letters.get(random.nextInt(letters.size())));
4343
}
4444

45-
return password;
45+
return password.toString();
4646
}
4747
}

0 commit comments

Comments
 (0)