I am making a console based strategy game like Genghis Khan: Legend of the White Wolf, although it is in console. How can I implement the Random Calculation in there? First off, the game goes like this, for example you have 34 Soldiers and the enemy has 45 Archers. Say you attack the Archers, normally it is not good to subtract the number of archers from the number of Soldiers. How can I implement a random difference using Random Method? I made it this way though:
int result = 1+r.nextInt(20);
for (int j = 1; j <= 1; j++) {
System.out.println(result);
}
}
attacker -= result;
Is that okay? How about for the Defender? Should I make another random result for the damage to them? Is there an easy coding here rather than this lengthy one I did?