First of all, I think you better use the Random class rather the Math.random()
. If you want the game to continue until a certain condition is true, you can use the while loop:
while(expression)
{
//do something
}
As long as the expression is true, the loop will continue. In your case, you want the expression to be true if the dice are not 2,3,7,11 or 12.
int diceSum = dice1 + dice2; //This will hold the sum of both dice tosses.
while(diceSum != 2 && diceSum != 3 && diceSum != 7 && diceSum !=11 && diceSum != 12)
{
//do something
}
Try to work with this code, and if you encounter any problems post your new code here and we'll help you out :) (Please use the (code) button when posting code)