Skip to content

Instantly share code, notes, and snippets.

@joswlv
Last active October 5, 2018 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joswlv/4035eeb270f24efdcf60511521ecfc26 to your computer and use it in GitHub Desktop.
Save joswlv/4035eeb270f24efdcf60511521ecfc26 to your computer and use it in GitHub Desktop.
Datayanolja
/*
사용된 java version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
*/
public class Lottery {
@Test
public void Run() throws IOException {
//추첨
List<String> candidateList = Files.lines(Paths.get("이메일_목록")).collect(Collectors.toList());
pickUP(candidateList, 추첨인원).stream().forEach(System.out::println);
}
public static List<String> pickUP(List<String> lst, int n) {
List<String> shuffleList = new LinkedList<>(lst);
Collections.shuffle(shuffleList);
return shuffleList.subList(0, n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment