Cato,
Here is code that I tried out for generating a user id using the user name
I have to pass a string and it returns a 8 digit alpha numeric
Hope it helps,
Anil
public static String getCode(String text){
This seems ok for the job. There should be some speedups if you need them.
Cheers
// --- cut ---
public class GenID {
private static String validChars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
private int _IDlength;
public GenID(int IDlength) {
_IDlength =
i did this a few weeks ago; the code is far from "clean'n'nice", but it does
what it's supposed to, here goes:
Random pwdGen = new Random( System.currentTimeMillis() );
Character temp = new Character( 'a' );
StringBuffer pwd = new StringBuffer();
Vector charPwd = new Vector();
int i = 0;
//0-9
This intrigued me so I just wrote this little program. Of course it could
be wrapped up in a bean and it needs to check against a list of established
passwords but it gives you upper-lower case random sequence of alpha-numeric
characters. Just feed it the length that you want. It even cleans up