Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.illegalArgument exception for nextInt #5

Open
tomsiwik opened this issue Sep 13, 2011 · 2 comments
Open

java.lang.illegalArgument exception for nextInt #5

tomsiwik opened this issue Sep 13, 2011 · 2 comments

Comments

@tomsiwik
Copy link

rarely getting error above for:

java.util.Random.nextInt() -> _randomKey():

"int position = r.nextInt(key.length() - 1) + 1;"

Sorry for the confusion, it's my first Issue i have found and posted.
Greetings.

@jacksun101
Copy link

Yes, this error forces my application close. Please help..

@jeremycw
Copy link
Contributor

jeremycw commented May 9, 2012

key.length() - 1 can be 0

r.nextInt must be given a number > 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants