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

Negative Array Size Exception When M=1 #15

Open
ashfaq92 opened this issue Nov 21, 2019 · 1 comment
Open

Negative Array Size Exception When M=1 #15

ashfaq92 opened this issue Nov 21, 2019 · 1 comment

Comments

@ashfaq92
Copy link
Contributor

Hi, this algorithm throws an error when value of M=1. It works fine at M=0 and M=2. Any specific reasons for not working at M=1?

@jelmerk
Copy link
Owner

jelmerk commented Nov 25, 2019

Hmm the levelLambda defaults to levelLambda = 1 / Math.log(this.m) which becomes Infinity at m = 1

which makes assignLevel return Integer.MAX_VALUE

and then I do IntArrayList[] connections = new IntArrayList[randomLevel + 1]; which overflows the integer and makes it become negative..

lovely.. i'll see if i can fix this

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

2 participants