Random User Email Generator

  • Share this:

Code introduction


The function generates a random user email address using the Person module from the Mimesis library. It first retrieves an email address from the Person module, then randomly selects the username part of the address, and returns the complete email address.


Technology Stack : Mimesis, Python

Code Type : Function

Code Difficulty : Intermediate


                
                    
def generate_random_user_email():
    import random
    from mimesis import Person

    def random_user_email():
        name = Person().email()
        domain = Person().domain()
        return f"{random.choice(name.split('@'))}@{domain}"

    return random_user_email()                
              
Tags: