rt

An obligatory Java Project
Log | Files | Refs | LICENSE

commit 2a9945589bf0c9e2180414197dd75d744ff34da6
parent 682751dca8ff26aa40622e958e6f75666251f6ef
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Fri, 13 Dec 2019 01:17:04 +0100

Implement getAlphaNumString() to return unique alphanum group id

Diffstat:
Mutil.java | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/util.java b/util.java @@ -41,4 +41,16 @@ public class util { return 1; return res; } + + public static String getAlphaNumString() { + String AlphaNumericString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + + "0123456789" + + "abcdefghijklmnopqrstuvxyz"; + StringBuilder sb = new StringBuilder(10); + for (int i = 0; i < 10; i++) { + int index = (int)(AlphaNumericString.length()* Math.random()); + sb.append(AlphaNumericString.charAt(index)); + } + return sb.toString(); + } }