Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List <String> diceColorsList = new ArrayList<String>(Arrays.asList("red", "blue", "green", "yellow", "white"));
- public String rollDiceColor(){
- Random rand = new Random();
- if (diceColorsList.size() > 0) {
- int n = rand.nextInt(diceColorsList.size());
- String str = diceColorsList.get(n);
- diceColorsList.remove(n);
- return str;
- } else {
- return "0";
- }
- }
- public int rollDiceNumber(){
- Random rand = new Random();
- int n = rand.nextInt(3)+1;
- return n;
- }
- public void resetDice(){
- diceColorsList = new ArrayList<String>(Arrays.asList("red", "blue", "green", "yellow", "white"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement