Any Idea how I generate random Char values in Java? I'm creating a random password generator -
this question has answer here:
- how generate random alpha-numeric string? 39 answers
i'm creating random password generator in java , need how can generate random char values in program. ideas? i'm using menu system way show different types of passwords generate lowercase, uppercase, etc.
any advice help.
thanks!
random r = new random(); string alphabet = "123xyz"; // prints 50 random characters alphabet (int = 0; < 50; i++) { system.out.println(alphabet.charat(r.nextint(alphabet.length()))); }
instead of printing chars, add them stringbuilder
, , have random password.
Comments
Post a Comment