Does Java have any functionality to generate random characters or strings? Or must one simply pick a random integer and convert that integer's ascii code to a character?
To generate a random char in a-z:
Random r = new Random(); char c = (char)(r.nextInt(26) + 'a');
2.1m questions
2.1m answers
60 comments
57.0k users