import java.util.Random;
import java.util.TimerTask;
import java.util.Vector;
public class RandomTest extends TimerTask
{
Random random ;
public int max_Mouse;
public int mouse_Id;
public int old_mouseId;
public boolean isSameMouse_Id;
public Vector<Integer>mouse_Appreace ;
RandomTest()
{
mouse_Id = -1;
isSameMouse_Id = false;
random = new Random();
mouse_Appreace = new Vector<Integer>();
}
public static void main(String[] args) {
new RandomTest().run();
}
public void run() {
max_Mouse=random.nextInt(4)+1;
for (int i = 0; i < max_Mouse; i++) {
mouse_Id=random.nextInt(8)+1;
for (int j = 0; j < mouse_Appreace.size(); j++) {
old_mouseId=mouse_Appreace.elementAt(j);
if(old_mouseId==mouse_Id)
{
i--;
isSameMouse_Id=true;
continue;
}
}
if (isSameMouse_Id) {
isSameMouse_Id=false;
continue;
}
mouse_Appreace.add(mouse_Id);
}
}
}