Created
March 29, 2020 13:45
-
-
Save riajulkashem/869a42a9c8cc7ab9364eeec4870931c5 to your computer and use it in GitHub Desktop.
random name, random email and random phone number generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import string | |
domains = ["hotmail.com", "gmail.com", "mail.com", "yahoo.com", 'tman.com'] | |
letters = string.ascii_lowercase[:26] | |
def get_random_domain(): | |
return random.choice(domains) | |
def get_random_name(length): | |
return ''.join(random.choice(letters) for i in range(length)) | |
def generate_random_emails(length=8, nb=1): | |
return [get_random_name(letters, length) + '@' + get_random_domain(domains) for i in range(nb)] | |
def generate_phone_number(length): | |
""" | |
random phone number generator | |
:type n: specify length of phone number | |
""" | |
range_start = 10 ** (length - 1) | |
range_end = (10 ** length) - 1 | |
return random.randint(range_start, range_end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment