I have been poring over these links: Randomly select an item from a list printing an array from .txt file java How to shuffle the contents of an array
But they are confusing me as much as helping?
I'm pretty sure I want to use the line
public static void shuffle `(String[] array)` // mix-up the array
but I'm not sure what the lines
(String[] array)
are referencing.
I would like to have one method that reads an array (needs to read it first so it knows what to shuffle right??), shuffles it, and then saves the new text file; or reads an array and pulls a random one from the list.
I'm confused by how to use ArrayList together with string.
How do I tell Java what file to read? How do I tell it exactly how to parse what it's reading. Should I just have it read line by line and pull a random line to show me?
public static void Encounter()
Scanner wildInput = new Scanner(new File("WildPkmn.txt"));
randomGenerator = new Random();
}
}
See:
}