• Source
    1. import java.util.*;
    2. import java.lang.*;
    3. import java.io.*;
    4.  
    5. class Ideone {
    6. public static void main (String[] args) throws java.lang.Exception {
    7. Set<Integer> set = new HashSet<>();
    8.  
    9. for(int i=0; i<100; i++) {
    10. set.add((int)Math.ceil(Math.random()*1000000));
    11. }
    12.  
    13. System.out.print(set);
    14. }
    15. }