Advertisement
Triacontakai

DiceRoll

Jan 25th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.68 KB | None | 0 0
  1. /**
  2. * Triacontakai
  3. * This program generates a certain amount of numbers between a specified range, both specified by the user
  4. * Input: Range and Amount
  5. * Output: Random Number between 1-range, generated "amount" times
  6. */
  7. import java.util.*;
  8. public class DiceRoll {
  9.     public static void main(String[]args) {
  10.         Scanner scan = new Scanner(System.in);
  11.         Random rnum = new Random();
  12.         int counter;
  13.         System.out.println("Enter range (1-n): ");
  14.         int range = scan.nextInt();
  15.         System.out.println("Enter amount of dice rolls: ");
  16.         int count = scan.nextInt();
  17.         for (counter = 1; counter <= count; counter++) {
  18.            
  19.             int x = rnum.nextInt(range)+1;
  20.             System.out.println(x);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement