so whenever i run the program, it always prints out 9 and 5 for sc1 and sc2. Not sure why. I thought that the random class was supposed to be mostly random.Any help?
public class BlackJack {
public static BlackJack blackjack;
public int chips;
public static int[] deck;
public static int ct = 0, sc1, sc2;
Random random;
public BlackJack() {
deck();
deal();
System.out.println(sc1);
System.out.println(sc2);
}
public void deck() {
deck = new int[52];
for (int i = 0; i < 52; i++) {
if(i % 4 == 0) {
ct++;
}
deck[i] = ct;
}
}
public void deal() {
random = new Random(52);
sc1 = deck[random.nextInt(52)];
sc2 = deck[random.nextInt(52)];
}
public static void main(String[] args) {
blackjack = new BlackJack();
}
}
Aucun commentaire:
Enregistrer un commentaire