Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Last active April 2, 2019 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MelanieS/d65c29524091f105d7dbcfb218cda42f to your computer and use it in GitHub Desktop.
Save MelanieS/d65c29524091f105d7dbcfb218cda42f to your computer and use it in GitHub Desktop.
RollingDie
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rollingdie;
import java.util.Random;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
/**
*
* @author mshebel
*/
public class RollingDie {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Random rand;
rand = new Random();
Scanner input = new Scanner(System.in);
System.out.println("Enter array size:");
int arrSize = input.nextInt();
int[] myRoll;
myRoll = new int[arrSize];
for (int i = 0; i < myRoll.length; i++) {
myRoll[i] = rand.nextInt(6)+1;
}
System.out.println(Arrays.toString(myRoll));
}
// TODO code application logic here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment