Java tutorial
import java.util.Arrays; import java.util.Random; public class Main { public static void main(String[] args) throws Exception { int[] ints = new Random().ints(1, 50).distinct().limit(6).toArray(); System.out.println(Arrays.toString(ints)); } }