Password Generator
I am trying to create a program that generates random passwords using the characters A-Z and the numbers 0-9. It will also have an input of what you want the length of the password to be.
What I don't know how to do is to create a method to choose random, arbitrary characters/ numbers.
Are there any objects that specialize in selecting random characters?
bloody_ninja
Junior Poster in Training
96 posts since Jul 2008
Reputation Points: 9
Solved Threads: 2
String array of A-Z characters and integers 0-9, which makes 36 elements (26 letters plus 10 numbers). Create random number generator between 0-35 with "i" loop to get password of certain length. Wouldn't be that the simplest solution?
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
String array of A-Z characters and integers 0-9, which makes 36 elements (26 letters plus 10 numbers). Create random number generator between 0-35 with "i" loop to get password of certain length. Wouldn't be that the simplest solution?
I was thinking about that, but I still don't know how to write line to generate a random number 0-35. I just need that one line that generates the randomness, arg.
bloody_ninja
Junior Poster in Training
96 posts since Jul 2008
Reputation Points: 9
Solved Threads: 2
Math.random()
The above returns a random number between 0 and 1
a pseudorandom double greater than or equal to 0.0 and less than 1.0. Math.random()
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
HOw to get random number between 0 -35
Random rand = new Random();
int num = rand.nextInt(35);
peter_budo
Code tags enforcer
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902