Created
September 26, 2020 13:28
-
-
Save matthewmorrone/0abe551e20b2fedf63a2b6279d53cb08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static Integer[] performLottery(int numNumbers, int numbersToPick) { | |
| List<Integer> numbers = new ArrayList<>(); | |
| for(int i = 0; i < numNumbers; i++) numbers.add(i + 1); | |
| Collections.shuffle(numbers); | |
| return numbers.subList(0, numbersToPick).toArray(new Integer[numbersToPick]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment