I want to generate 6 different random numbers by using Math.random and store them into an array. How can I make sure that they are different? I know I need to use for-loop t
I've just came up with a small idea for Java 8-.
Set set = new LinkedHashSet<>(); while(set.size() != 6) set.add(rnd.nextInt(49) + 1);