could someone explain this code please .. i want to know is the random number going to be between 1 and 6? or this step generates random numbers and initialize it to frequency[1+generator.nextInt(6)]++; if am wrong could someone explain the last statement ..
frequency=new int[7];
public void rollIt() {
Random generator = new Random();
for(int i=1;i<frequency.length;i++)
frequency[1+generator.nextInt(6)]++;
}
Aucun commentaire:
Enregistrer un commentaire