so all i want to do is roll 1 die repeatedly and add it to a total until the total is equal to or greater than 31
this is what i have got to so far
import java.io.*;
import java.util.*;
public class comp {
public static void main(String[] args)
throws FileNotFoundException {
Scanner user = new Scanner(System.in);
Random r = new Random();
int roll;
int comptotal = 0;
do{
roll = r.nextInt(6) + 1;
comptotal = comptotal + roll;
}while (comptotal >= 31);
System.out.println(comptotal);
}}
it only rolls the die once i can't think of another way to roll the die again and keep rolling it until the total is equal to or greater than 31