import java.util.Random; public class Roll { private final static Random random = new Random(); static int roll(int ndie, int nsides) { int tot = 0; double num_sides = 0.0d; int temp2 = 0; num_sides = nsides; tot = 0; while (ndie-- != 0) { temp2 = random.nextInt((int) num_sides) + 1; tot += temp2; } return tot; } }