Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class ShorterDoubleDice
- {
- public static void main(String[] Args)
- {
- Random rng = new Random();
- int roll1, roll2, tries = 0;
- System.out.println("Here Comes The Dice!");
- do
- {
- roll1 = 1 + rng.nextInt(6); roll2 = 1 + rng.nextInt(6);
- System.out.println("Roll #1: " + roll1 + "\nRoll #2: " + roll2 + "\nThe total is " + (roll1 + roll2) + "\n" );
- tries ++;
- } while (roll1 != roll2);
- System.out.println("You got a double after " + tries + " tries!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement