1# -------------------------------------------------------------------------------------------- 2# Copyright (c) Microsoft Corporation. All rights reserved. 3# Licensed under the MIT License. See License.txt in the project root for license information. 4# -------------------------------------------------------------------------------------------- 5 6import os 7import random 8 9 10def generate_username(): 11 directory_path = os.path.dirname(__file__) 12 adjectives, nouns = [], [] 13 with open(os.path.join(directory_path, 'adjectives.txt'), 'r') as file_adjective: 14 with open(os.path.join(directory_path, 'nouns.txt'), 'r') as file_noun: 15 for line in file_adjective: 16 adjectives.append(line.strip()) 17 for line in file_noun: 18 nouns.append(line.strip()) 19 adjective = random.choice(adjectives) 20 noun = random.choice(nouns) 21 num = str(random.randrange(10)) 22 return adjective + noun + num 23