Refactoring: move methods around, renamed things for consistency and readability:
n -> length
generate_random_id -> generate_short_random_id
find_unique_random_id -> generate_short_random_unique_id.