Random Material Color Selector

an anonymous user · January 14, 2021 · Java
import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
      final String[] color_noun = {"Amber", "Blue", "Blue Grey", "Brown", "Cyan", "Deep Orange", "Deep Purple", "Green", "Grey", "Indigo", "Light Blue", "Light Green", "Lime", "Orange", "Pink", "Purple", "Red", "Teal", "Yellow" };

      final String[] color_number = {"50", "100", "200", "300", "400", "500", "600", "700", "800", "900"};
      
      Random random = new Random();
        int indexNoun = random.nextInt(color_noun.length);
        
        int indexNumber = random.nextInt(color_number.length);

System.out.println(color_noun[indexNoun]+"-"+color_number[indexNumber]);
    }
}

Comments

Please sign up or log in to contribute to the discussion.