Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ArrayList<Integer> lottoZahlen() {
- ArrayList<Integer> gewinnZahlen = new ArrayList<Integer>();
- for (int i = 0; i < 6; i++) {
- //generiert eine zufallszahl zwischen 0 und 49
- int one = (int) (Math.random() * 49);
- if (!gewinnZahlen.contains(one) && one != 0) {
- gewinnZahlen.add(one);
- } else {
- i--;
- continue;
- }
- }
- System.out.println("Die Gewinnzahlen sind: " + gewinnZahlen);
- return gewinnZahlen;
- }
Add Comment
Please, Sign In to add comment