dimanche 18 octobre 2015

How to make a random number pattern generator?

My case is that I'm trying to find a random number pattern generator code but I really can't seem to find it. I need to use "1" , "2", "3", "4", "5" and "6" to create a random pattern with 4 digits like 1111, 1264, 2564 and etc. I tried this but it's not working.

public static void computer() {
List<Integer> template = Arrays.asList(1, 2, 3, 4, 5, 6);
    for (int i = 0; i < 10; ++i) {
        List<Integer> items = new ArrayList<Integer>(template);
            Collections.shuffle(items);
            System.out.println(items);

    }
}




Aucun commentaire:

Enregistrer un commentaire