Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

C2X7a_Yahtzee.java

By: calcpage on Sep 22nd, 2011  |  syntax: Java  |  size: 0.52 KB  |  views: 130  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Yahtzee.java          MrG     2011.0921
  2. import java.util.Random;
  3. public class Yahtzee
  4. {
  5.         public static void main(String[] args)
  6.         {
  7.                 System.out.print("roll = ");
  8.                 Random die = new Random();
  9.                 int roll = die.nextInt(6)+1;
  10.                 System.out.print(roll + " ");
  11.                 roll = die.nextInt(6)+1;
  12.                 System.out.print(roll + " ");
  13.                 roll = die.nextInt(6)+1;
  14.                 System.out.print(roll + " ");
  15.                 roll = die.nextInt(6)+1;
  16.                 System.out.print(roll + " ");
  17.                 roll = die.nextInt(6)+1;
  18.                 System.out.print(roll + " ");
  19.                 System.out.println();
  20.         }
  21. }
clone this paste RAW Paste Data