fork download
  1. import java.util.Random;
  2.  
  3. class RandomLoginGenerator
  4. {
  5. private static final String[] syllables = {"qu_rk", "w_rt", "r_t", "t_r",
  6. "z_p", "pr_", "s_m", "d_ng", "f_nd", "g_ng", "h_hn", "j_ng",
  7. "k_st", "l_hn", "b_nd", "n_st", "m_st"};
  8.  
  9. private static final String vowels = "aeiouy";
  10.  
  11. private static final Random rng = new Random();
  12.  
  13. public static String randomString(int length)
  14. {
  15. int s = syllables.length;
  16. int v = vowels.length();
  17. StringBuilder sb = new StringBuilder();
  18. for (int i = 0; i < length; ++i)
  19. {
  20. String syllable = syllables[rng.nextInt(s)];
  21. char vowel = vowels.charAt(rng.nextInt(v));
  22. sb.append(syllable.replace('_', vowel));
  23. }
  24. return sb.toString();
  25. }
  26.  
  27. public static void main(String[] args)
  28. {
  29. System.out.println("user: " + randomString(4));
  30. System.out.println("pass: " + randomString(2));
  31. System.out.println("mail: " + randomString(3) + "@" + randomString(1) + ".com");
  32. }
  33. }
  34.  
Success #stdin #stdout 0.09s 320320KB
stdin
Standard input is empty
stdout
user: kostmystgongnyst
pass: simquurk
mail: rutnustkist@quyrk.com