I have to create a class that will pick partners at random for my class tomorrow, out of the people that are in it.
What I have so far is simple enough...
import java.util.*;
import java.util.Random;
public class GetPartners {
public GetPartners() {
}
public void getPartner() {
String[] names = { "Lukas", "Michele", "Megan", "Lindsey", "Victoria", "Andrew", "Gino", "Andrew", "Chris", "Steve", "Ryan", "Dan", "John", "Andre", "Pat", "Ruta", "Vince" } ;
Random r = new Random();
x = r.nextInt(18);
y = r.nextInt(18);
System.out.println(names[y]+" "+names[x]);
}
private int x;
private int y;
}
And in a tester class, it picks the partners at random and all, but I don't know what to do to make everyone get a partner and every person to be included... Since the tester repeats people.