dimanche 28 décembre 2014

Random Number Minecraft

Im trying to set a random number but excluding a certain number in the random.



public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {


Player player = (Player) sender;

if(commandLabel.equalsIgnoreCase("random")){

Random random = new Random();

int randomId = random.nextInt(300);

if(randomId >= 100 && randomId <= 200){
player.sendMessage("" + randomId);
}

while(randomId != 124){

randomId = random.nextInt(300);

}

}


I want to EXCLUDE the number 124 in the random.





Aucun commentaire:

Enregistrer un commentaire