我觉得可以 获取随机数并对4取模
然后switch判断
public static Lamp random(){
int random = new Random().nextInt(10)%4;//获取随机数并对4取模
switch(random){//进行判断
case 0:
return RED;
break;
case 1:
return GREEN;
break;
case 2:
return BOX;
break;
case 3:
return BLUE;
break;
}
我觉得可以 获取随机数并对4取模
然后switch判断
public static Lamp random(){
int random = new Random().nextInt(10)%4;//获取随机数并对4取模
switch(random){//进行判断
case 0:
return RED;
break;
case 1:
return GREEN;
break;
case 2:
return BOX;
break;
case 3:
return BLUE;
break;
}