Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

random.nextInt + If statements

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a password generator/fake password hacker. Is there a better way to do this?

Thanks,
John Price aka cc11rocks
 
Henry Wong
author
Marshal
Pie
Posts: 21114
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
john price wrote:I am creating a password generator/fake password hacker. Is there a better way to do this?

Thanks,
John Price aka cc11rocks


You seem to have a couple of bugs -- such as 22 is assigned to two letters, but I get the gist of what you are trying to do....

Try....



Henry
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works perfect thanks! Could you please explain this:

Like I understand it but why is this possible? I see
"char = char1 + char2 - int"
Thanks,
cc11rocks aka John Price
 
Henry Wong
author
Marshal
Pie
Posts: 21114
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
john price wrote:
Like I understand it but why is this possible? I see
"char = char1 + char2 - int"


Please take another look again. You'll see that it is something else, and it is valid.

Henry
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help. Here is the program I came up with:

I'm going to add more JRadioButtons (more password length options), but here it is. It is fully runnable. Thank you very much!
cc11rocks aka John Price
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic