Advertisement
Sketchware

Gerar 4 cartelas LOTOFACIL

Jan 17th, 2023
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. TextView textView1 = (TextView) findViewById(R.id.textview1);
  2. TextView textView2 = (TextView) findViewById(R.id.textview2);
  3. TextView textView3 = (TextView) findViewById(R.id.textview3);
  4. TextView textView4 = (TextView) findViewById(R.id.textview4);
  5.  
  6. Set<Integer> randomNumbers1 = new HashSet<>();
  7. while (randomNumbers1.size() < 15) {
  8.     randomNumbers1.add(new Random().nextInt(26));
  9. }
  10.  
  11. Set<Integer> randomNumbers2 = new HashSet<>();
  12. while (randomNumbers2.size() < 15) {
  13.     randomNumbers2.add(new Random().nextInt(26));
  14. }
  15.  
  16. Set<Integer> randomNumbers3 = new HashSet<>();
  17. while (randomNumbers3.size() < 15) {
  18.     randomNumbers3.add(new Random().nextInt(26));
  19. }
  20.  
  21. Set<Integer> randomNumbers4 = new HashSet<>();
  22. while (randomNumbers4.size() < 15) {
  23.     randomNumbers4.add(new Random().nextInt(26));
  24. }
  25.  
  26. textView1.setText(TextUtils.join(", ", randomNumbers1));
  27. textView2.setText(TextUtils.join(", ", randomNumbers2));
  28. textView3.setText(TextUtils.join(", ", randomNumbers3));
  29. textView4.setText(TextUtils.join(", ", randomNumbers4));
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement