You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import java.security.SecureRandom;
public class PasswordGenerator {
final String lowercaseCharacters = "abcdefghjkmnpqrstuvwxyz";
int length = 12;
public int getLength() { return length; }
public void setLength(int length) { this.length = length; }
public String generateRandomPassword() { StringBuilder generatedPassword = new StringBuilder(); SecureRandom rand = new SecureRandom();
for (int generatorPosition = 0; generatorPosition < getLength(); generatorPosition++) { generatedPassword.append(lowercaseCharacters.charAt(rand.nextInt(lowercaseCharacters.length()))); } return generatedPassword.toString(); } }
|