dimanche 17 octobre 2021

Can you make if/else statements for when rand.nextInt() = 0?

This is a segment of the code for my program. What I'm trying to do is match the health of the enemy with the random enemy that get selected. My plan is to make a condition for when the randomInt selects a number so I can print out the correct enemyHealth value from my array. Is there any way I can set the a condition for when rand.nextInt is equal to some number?

if(rand.nextInt(enemy.enemyType) = 0)

    System.out.println(enemy.enemyHealth[0]);

Aucun commentaire:

Enregistrer un commentaire