This is one that CSLIB has an implementation of you can reference: cslib/cslib_number.txt at main · ChoicescriptIDE/cslib · GitHub
(Look for the “max_stat” label).
Usage:
*create player_strength 5
*create player_dexterity 8
*create player_intelligence 8
*gosub_scene cslib_number max_stat "player_strength" "player_dexterity" "player_intelligence"
${cslib_ret} == "player_dexterity"
The only difference is that equal values aren’t randomised, it just sticks with the first encountered one instead. Which is probably fine for most use cases?