just a quick question, I've been trawling the interwebs for almost a day, and I figured... hell I'll just ask.
I've been trying to make a score keeping method for blackjack (oh yes there are 100's of pages of code to reference, none have the segment I'm looking for)
All I want is an int array to return, a value between 1 and 11, and then repeat it, returning a different random value.
I have tried dozens of methods, and I'm either not skilled enough to make it work, or the method doesn't suit the rest of my code.
here is what I am trying most recently.
import java.util.Random;
import java.util.Scanner;
class jacktest
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner input = new Scanner(System.in);
String name;
boolean playing = true;
boolean notplaying = true;
int ncard = 1 + r.nextInt(11);
for (i=0; i>11; ++i);
System.out.println("two cards from the same int: "+ncard +ncard);
}
}
can someone save me some torture, and explain to me, why ncard + ncard yeilds the same number on both occurances?
or what would be a better way to get the same result?
Thanks
Aucun commentaire:
Enregistrer un commentaire