math.random, generuje tylko 0?
Poniższy kod tworzy tylko 0; -;
Co ja robię źle?
public class RockPaperSci {
public static void main(String[] args) {
//Rock 1
//Paper 2
//Scissors 3
int croll =1+(int)Math.random()*3-1;
System.out.println(croll);
}
}
Edytuj, inny plakat zasugerował coś, co go naprawiło. int croll = 1 + (int) (Math.random () * 4 - 1);
Dziękuję wszystkim!