Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set<Integer> uniqueNumbers1 = new HashSet<>();
- while (uniqueNumbers1.size() < 16) {
- uniqueNumbers1.add((int)(Math.random()*26));
- }
- List<Integer> randomNumbers1 = new ArrayList<>(uniqueNumbers1);
- TextView textView1 = (TextView) findViewById(R.id.textview1);
- textView1.setText(TextUtils.join(", ", randomNumbers1));
- Set<Integer> uniqueNumbers2 = new HashSet<>();
- while (uniqueNumbers2.size() < 16) {
- uniqueNumbers2.add((int)(Math.random()*26));
- }
- List<Integer> randomNumbers2 = new ArrayList<>(uniqueNumbers2);
- TextView textView2 = (TextView) findViewById(R.id.textview2);
- textView2.setText(TextUtils.join(", ", randomNumbers2));
- List<Integer> randomNumbers3 = new ArrayList<>(randomNumbers1);
- randomNumbers3.retainAll(randomNumbers2);
- TextView textView3 = (TextView) findViewById(R.id.textview3);
- textView3.setText(TextUtils.join(", ", randomNumbers3));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement