Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.67 KB | None | 0 0
  1.  persons.add(new Person("Piotrek","p1otrek239922@gmail.com",0));
  2.         persons.add(new Person("Michał","michal.latus@gmail.com",1));
  3.         persons.add(new Person("Ola","mann.aleksandra@gmail.com",2));
  4.         persons.add(new Person("Weronika","weronika@xgen.pl",3));
  5.         persons.add(new Person("Heska","heska96@gmail.com",4));
  6.         persons.add(new Person("Filip","filip.karolczak@gmail.com",5));
  7.         persons.add(new Person("Rafał","rafaa1994@gmail.com",6));
  8.         persons.add(new Person("Paweł","Pawelczykesik@gmail.com",7));
  9.        
  10.         //persons.add(new Person("","michal.latus@gmail.com",1));
  11.         String from = USER_NAME;
  12.         String pass = PASSWORD;
  13.         String[] to = new String[persons.size()];
  14.         for(int i=0;i<persons.size();i++)
  15.         to[i] = persons.get(i).getEmail(); // list of recipient email addresses
  16.         String subject = "TESTUJEMY APKE";
  17.         String body = new String();//= "Jak widzisz tego maila to znaczy, że apka do losowania już działa ! \nPozdrawiam :D ";
  18.         ArrayList<Integer> numbers = new ArrayList();
  19.         int i = 0;
  20.        while (i < persons.size()){
  21.        
  22.             Random rand = new Random();
  23.             int current_idx = rand.nextInt(persons.size());
  24.             if(current_idx != persons.get(i).getNumber() && !numbers.contains(current_idx)){
  25.             //body =
  26.                 System.out.println("Hohoho "+ persons.get(i).getName()+"! W tym roku trafił/a Ci się : " + persons.get(current_idx).getName());
  27.             i++;
  28.             numbers.add(current_idx);
  29.            }
  30.            
  31.        
  32.         }
  33.        
  34.         //sendFromGMail(from, pass, to, subject, body);
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement