Alan
2009-12-17 19:40:30 UTC
public static char random63Characters()
{
String password = "";
for(int i = 0; i < DEFAULT_PWD_SIZE; i++)
{
double r = Math.random();
if(r < 26.0/63.0)
return randomUppercase();
else if (r < 52.0/63.0)
return randomLowercase();
else if (r < 62.0/63.0)
return randomDigit();
else
return '_';
}
return ;
}
The methods each return what they say(i.e randomDigit returns a number from 0 - 10 and randomUppercase returns A - Z) and the DEFAULT_PWD_SIZE is 6.
It works fine without the for statement, but then it only prints out one character. I'm kind of having trouble with this, so please help.