Saturday, October 25, 2014

cmd doing nothing [objects arrays]
















HI, im new at the forum















I have to random shuffle an array of Card Objects which does the funcion of a deck. Heres the code:
























Java Code:




















public void barajear(){
int j;
for (int i=0;i<52;i++){
j=Baraja.random(51);
if (this.mazo[j]==null){
this.mazo[j]=this.arreglo[i];
}else{
--i;
}
}
}


















so bassically theres an array called "arreglo" which has the cards in order and the function "random" its an rng of numbers from 0 to 51.















what i'm trying to do it's to take the cards from the ordenated array and put them randomly in the other but only if it's empty.















(the array "mazo" has alredy been initialized with null).















it worked at first, but now, after compiling succesfully i tried to run it and the cmd just...















Attachment 6693















just stays there, i can't do anything: i can't type, just stays that way...















somebody knows why this is happening i don't know what to do















Thank you and sorry if my english is bad.






















No comments:

Post a Comment