Created
June 8, 2016 07:53
-
-
Save SergioLarios/b090ca9f798731d2529e74eb375b4877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String nextRngString() { | |
for (int idx = 0; idx < buf.length; ++idx) | |
buf[idx] = symbols[random.nextInt(symbols.length)]; | |
return new String(buf); | |
} | |
/* ***************************** | |
* **** Private constants ***** | |
***************************** */ | |
static { | |
StringBuilder tmp = new StringBuilder(); | |
for (char ch = '0'; ch <= '9'; ++ch) | |
tmp.append(ch); | |
for (char ch = 'a'; ch <= 'z'; ++ch) | |
tmp.append(ch); | |
symbols = tmp.toString().toCharArray(); | |
} | |
private static final char[] symbols; | |
private static final Random random = new Random(); | |
private static final char[] buf = new char[____NUMERO_DE_CARACTERES____]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment