From 06ec67206a01df8f9c2f44f4a206d037e963960f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 12 May 2016 14:06:37 +0200 Subject: [PATCH] added method generateRandomName() which generates a pseudo-random user name: user+max. 10 digits --- .../mxchange/jusercore/model/user/UserUtils.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 */ -- 2.39.5