AdhityaRimba

Untitled

Nov 11th, 2020 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.       int min = 10;
  2.       int max = 20;
  3.       ArrayList<Integer> rand = new ArrayList<>();
  4.       for(i=0;i<10;i++){
  5.         int rands = (int)(Math.random() * (max - min) + min);
  6.         Boolean found = true;
  7.         while(found){
  8.           found = false;
  9.           int c = 1;
  10.           while(c<i&&!found){
  11.             if(rand.get(c) == rands){
  12.               found = true;
  13.             }
  14.             c = c+1;
  15.           }
  16.           if(found){
  17.             rands = (int)(Math.random() * (max - min) + min);
  18.           }
  19.         }
  20.         rand.add(rands);
  21.         System.out.println(rand.get(i));
Add Comment
Please, Sign In to add comment