Katton.pick / pickMany
Katton.pick
Katton.pick(list)
returns one random element from a list, or null if the list is empty
val colors = ["red", "blue", "lime", "yellow"]
val chosen = Katton.pick(colors)
Katton.log.info("chosen color: " + chosen)
always consider that the pick could potentially return something empty
Katton.pickMany
Katton.pickMany(list, amount)
returns up to amount unique random elements (never duplicates)
val allPlayers = Katton.players.all()
val winners = Katton.pickMany(allPlayers, 3) // pick 3 random winners, or fewer if there arent 3 players
for (winner in winners) {
winner.sendMessage("&6you won!")
}