jbertram commented on code in PR #5487:
URL: https://github.com/apache/activemq-artemis/pull/5487#discussion_r1952025336


##########
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/RandomUtil.java:
##########
@@ -31,17 +31,56 @@ public static Random getRandom() {
       return random;
    }
 
+   private static String letters = "abcdefghijklmnopqrstuvwxyz";
+
+   private static String digits = "0123456789";
+
+   private static String randomBase = letters + letters.toUpperCase() + digits;
+
+   /**
+    * Utility method to build a {@code String} filled with random 
alpha-numeric characters. The {@code String} will
+    * contain characters from the following:
+    * <ul>
+    *    <li>abcdefghijklmnopqrstuvwxyz</li>
+    *    <li>ABCDEFGHIJKLMNOPQRSTUVWXYZ</li>
+    *    <li>0123456789</li>
+    * </ul>
+    * @param length how long the returned {@code String} should be
+    * @return a {@code String} of random alpha-numeric characters
+    */
+   public static String randomAlphaNumericString(int length) {
+      StringBuilder result = new StringBuilder(length);
+      for (int i = 0; i < length; i++) {
+         result.append(randomBase.charAt(randomInterval(0, 
randomBase.length())));
+      }
+      return result.toString();
+   }
 
-   public static String randomString() {

Review Comment:
   I suppose I agree with you _technically_ speaking, although this not part of 
the APIs that we actually care about, document, and actually protect from 
breaking changes so I feel it's a gray area, and I'm OK with changing it.
   
   Undeleting the `RandomUtil` in the `artemis-test-support` module and moving 
all the methods there would make the overall intention for this class more 
clear, but there are still some production classes that use these methods and 
it would proliferate the use of `artemis-test-support` across a bunch of 
modules that don't already use it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to