I am creating a tournament generator where there are 8 teams that the user inputs. I need to do a quarter-final where there are 4 matches between random teams. This is my code so far:
import java.util.Scanner;
public class A4Q1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("-----------------------------------------------------");
System.out.println(" Welcome to Tournament Outcome Predictor Program");
System.out.println("-----------------------------------------------------");
Scanner sc = new Scanner(System.in);
System.out.print("\nPlease enter a name for the football tournament: ");
String tName = sc.nextLine(); //name of tournament
int nbTeams = 8;
String[] footballTeams = new String [nbTeams];
System.out.println("\nPlease enter 8 participating teams: ");
for (int i = 0; i<nbTeams; i++) {
footballTeams[i] = sc.nextLine(); //storing 8 teams in array
}
My problem is that I do not know how to generate 8 random unique numbers. I was thinking of storing these number 0 to 7 in a new array but I am out of ideas!