I am new to coding so there mis probably a simple explanation to my problem. I am trying to generate a 2 random numbers in 2 different ranges (1-4 and 1-13) while each number in each range corresponds to a variable name. 1= "Hearts", 13 = "King". but the result for both random number generators are both always 0.
//this is the code in the class I wrote for the method shuffleSuit because 1 = hearts, 2 = spades, 3 = diamonds, 4 = clubs which is defined at the class level
public double shuffleSuit()
{
int random = (int)(Math.random() * 4 + 1);
System.out.println(shuffleSuit);
return shuffleSuit;
}
//this is the code for the faceValues so 2-10, king, queen, jack, ace
public int shufflefaceValue()
{
int random = (int)(Math.random() * 13 + 1);
System.out.println(shufflefaceValue);
return shufflefaceValue;
}
//the line I use to call them in my Card class demo is c.shuffleSuit(); c.shufflefaceValue();
the output is always 0 0
Aucun commentaire:
Enregistrer un commentaire