Ejemplo n.º 1
0
 public String generateRandomEmailAddress(String domain) {
   String emailAddress = "";
   // Generate random email address
   String alphabet = "abcdefghijklmnopqrstuvwxyz";
   while (emailAddress.length() < 5) {
     int character = (int) (Math.random() * 26);
     emailAddress += alphabet.substring(character, character + 1);
   }
   emailAddress += Integer.valueOf((int) (Math.random() * 99)).toString();
   emailAddress += "@" + domain;
   return emailAddress;
 }
Ejemplo n.º 2
0
  // Returns are randomly generated email id, part before the domain name
  private String shuffleEmail(String email) {

    String shuffledString = "";

    while (email.length() != 0) {
      int index = (int) Math.floor(Math.random() * email.length());
      char c = email.charAt(index);
      email = email.substring(0, index) + email.substring(index + 1);
      shuffledString += c;
    }

    return shuffledString;
  }