String getRandomElement(Random random, List<String> list) { if (list.isEmpty) { return ""; } int randomIndex = random.nextInt(list.length); return list[randomIndex]; }