Refactoring: extract finding a unique short rid out of the generation method.