I have tried to get this to print out 2 and 2 on separate lines. The separate lines part I've got down but for some reason the numbers this thing is outputting is 2 then 3. This is for an assignment for one of my chapters and getting a group together for help is challenging because of my work schedule. Can anyone help me to understand what is going on here? NOTE: seedVal starts at 4.
import java.util.Scanner;
import java.util.Random;
public class DiceRoll {
public static void main (String [] args) {
Random randGen = new Random();
int seedVal = 0;
randGen.setSeed(seedVal);
System.out.println(randGen.nextInt(seedVal));
System.out.println(randGen.nextInt(seedVal));
return;
}
}
Aucun commentaire:
Enregistrer un commentaire