What I'm trying to do is create a number of random numbers to be used for passwords.
The format I'm trying to achieve is some like 3794093 Y
. I have code to do this already but it involves creating a random int and a random char and combining the two. This would be alright but I would like the program to ask the user to enter their code. Should they enter their code and it matches it lets them access the program.
What I'm look for is a way to turn the random number and char into one string or something similar.
Here is code I currently have. I don't want the code done for me as I'd like to try and do it myself, just need advice on where I'm going wrong/what I'm missing.
Random r = new Random();
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0; i < 50; i++) {
int ppsn[]=new int[50]; //Array for student number
ppsn[i] = 3700000 + (int)(Math.random() * ((3800000 - 3700000) + 1));
System.out.println(ppsn[i]+" " +alphabet.charAt(r.nextInt(alphabet.length())));
}