Okay, so it's been awhile since I've posted on here, but I am having trouble figuring this problem out. So, students need to be assigned randomly to experiments. Experiment 1 has 5 participants, 2 has 10 participants, and 3 has 20 partcipants. Every iteration through the loop, it asks for a student's name to be typed, then it randomly picks an experiment for that string to be assigned to and displays the student's name and assignment to the console. Can someone please help me out on how to randomly get a number between 1-3?
import java.util.Scanner;
public class psy1113 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int experimentA;
int experimentB;
int experimentC;
String name;
int numberOfParticipants;
//Create a scanner
Scanner input = new Scanner(System.in);
numberOfParticipants = 0;
int experiment = (int)(Math.random());
do{
System.out.println("What is the name of the participant?");
name = input.next();
++numberOfParticipants;
}while (numberOfParticipants <= 35);
System.out.println("Here are all the stupid names:" + name);
}
}