Created
November 27, 2014 20:43
-
-
Save marlonlom/167ce0a3762e19574bec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Random; | |
public class BalotoDummyDemo { | |
public static void main(String[] args) { | |
Random rand = new Random(); | |
int max = 45; | |
int min = 1; | |
ArrayList<Integer> listNums = new ArrayList<Integer>(6); | |
do { | |
int randomNum = rand.nextInt((max - min) + 1) + min; | |
if (!listNums.contains(randomNum)) { | |
listNums.add(randomNum); | |
} | |
} while (listNums.size() < 6); | |
Collections.sort(listNums); | |
System.out.println("nums: " + listNums.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment