Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3.  
  4. public class DiceRolls {
  5.     public static int howBig = 20;
  6.     public static int[] rolls;
  7.    
  8.     public static int[] fillRolls(int size, int howMany) {
  9.         int[] destArray = new int[howMany];
  10.         for (int i=0; i<howMany; i++) {
  11.             Random dice = new Random();
  12.             destArray[i] = dice.nextInt(size)+1;
  13.         }
  14.  
  15.         return destArray;
  16.     }
  17.    
  18.  
  19.     public static void main(String[] Args) {
  20.         rolls = fillRolls(6, 5);
  21.         for (int i=0; i<5; i++) {
  22.             System.out.println(rolls[i]);
  23.         }
  24.  
  25.     }
  26.    
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement