import java.util.*;
public class Password{
public static void main(String arg[]){
String[] al = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"};
//System.out.println(al[1].toUpperCase());
ArrayList<String> pass = new ArrayList<String>();
int num = (int) (Math.random() * 10) + 1;
int upper = 100;
int lower = 50;
int r = (int) (Math.random() * (upper - lower)) + lower;
int num2 = (int) (Math.random() * 8) + 0;
int num3 = (int) (Math.random() * 8) + 0;
for (int i = 0; i < 8; i++){
int ran = (int)(Math.random() * 36) + 0;
if (i == num3) {
al[ran] = num + "";
}
if (i == num2){
ran = num;
pass.add(al[ran].toUpperCase());
}
else{
pass.add(al[ran]);
}
}
System.out.println(pass);
//Create a password that has all random values and is 8 characters long,
//but has at least one Capital letter, one lower case letter, and one number
//keep as random as possible
// new password to the pass arraylist
//You would want non alphanumeric character as well, but we're not including that here
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.