I have to create a program for school that asks the user how many letter he wants to create, and if he says for example 8, it will create the following:
char[] letters = new char[8]
It will then assign a random letter to each array indexes (0 to 7) and then the user has to guess the code comprised of 8 letters.
All I know about using random class is this:
letterValue = (char) (rand.nextInt(26) + 'a'); // Creates random letters a to z.
So how would I assign the 8 random letters to each index?
Aucun commentaire:
Enregistrer un commentaire