added function to generate unique IDs for each community