The function is useful for a variety of cases and there is already a family of related functions in rmgen1. See D4303 for an example.
Move the function to rmgen1, its not possible to use rmgen2 without importing rmgen-common anyway, so nothing broken on that front.
jsdoc correction and function cleanup for sortAllPlayers.
Make it return a Map instead of an array of arrays.
Check if the logic is duplicated within rmgen1 already.
Refs #4947 and rP21206.