public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
List<String> nameList = new ArrayList<>();
System.out.print("인원수를 입력해주세요 : ");
int size = Integer.parseInt(br.readLine());
int min = 0;
for (int i = 0; i < size; i++) {
System.out.print("이름을 입력해주세요 : ");
nameList.add(br.readLine());
}
int index = SecureRandom.getInstanceStrong().nextInt(size - min) + min;
System.out.println(nameList.get(index));
}
위의 코드를 챕터 1~4 내용을 기준으로 수정해보면 좋을 것 같아요
위의 코드를 챕터 1~4 내용을 기준으로 수정해보면 좋을 것 같아요