I've never heard of one. It would be great if you created one :D
Perhaps make a random number between a certain ascii character and another ascii character, then convert that to the appropriate char value. Then from there, add the charValue.toString() onto an actual string.
I'd do this for however many different characters you need.
Here s the one i am using:
public static String generateKey(int length)
{
String sKey="";
int randInt;
Random random=new Random(System.currentTimeMillis());
long r1 = random.nextLong();
long r2 = random.nextLong();
String hash1 = Long.toHexString(r1);
String hash2 = Long.toHexString(r2);
sKey = hash1 + hash2;
if(sKey.length()>length)
{
sKey=sKey.substring(0,length);
}
return sKey.toUpperCase();
}
> Here s the one i am using:
The method seems optimized. You get 16 random bytes (2 calls to Random). I suggest you instead create a char array of the wanted length. Then you fill it with length number of random chars of the kind you want. At the end you create a String from the char array. It will be length number of calls to Random but what the heck, it's not that expensive.
Fill a static array with the chars you desire and then generate a random index within the array. That will give you a random char. Then repeat X times where X is the number of chars you want in the String.