Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- // 2v2
- public class RandomTeamChooser {
- public static void main(String[] args) {
- String[] a = new String[]{"Achille", "Chaos", "Fear", "Saiga", "sexy1", "Potato", "Cr4sh", "fallen", "notas", "echo"};
- ArrayList<String> b = new ArrayList<String>();
- for(String s : a) b.add(s);
- while (! b.isEmpty()) {
- int n1 = (int)(Math.random() * b.size());
- int n2 = (int)(Math.random() * b.size());
- if (n1 == n2) continue;
- String p1 = b.get(n1);
- String p2 = b.get(n2);
- System.out.println(p1 + "\t" + p2);
- b.remove(p2);
- b.remove(p1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement