From: Roland Häder Date: Thu, 12 May 2016 12:06:37 +0000 (+0200) Subject: added method generateRandomName() which generates a pseudo-random user name: user... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=06ec67206a01df8f9c2f44f4a206d037e963960f;p=juser-core.git added method generateRandomName() which generates a pseudo-random user name: user+max. 10 digits --- diff --git a/src/org/mxchange/jusercore/model/user/UserUtils.java b/src/org/mxchange/jusercore/model/user/UserUtils.java index daa47e8..81749b3 100644 --- a/src/org/mxchange/jusercore/model/user/UserUtils.java +++ b/src/org/mxchange/jusercore/model/user/UserUtils.java @@ -188,6 +188,19 @@ public class UserUtils implements Serializable { return encryptedPassword.equals(container.getUser().getUserEncryptedPassword()); } + /** + * Generates a pseudo-random user name + *

+ * @return User name + */ + public static String generateRandomUserName () { + // User name's format is normally "user" + random number (10 digits) + String userName = String.format("user%d", RANDOM_NUMBER_GENERATOR.nextInt(10000000)); //NOI18N + + // Return it + return userName; + } + /** * No instance from this class */