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

some problems regarding this implementation #2

Open
superhail opened this issue Nov 19, 2019 · 1 comment
Open

some problems regarding this implementation #2

superhail opened this issue Nov 19, 2019 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@superhail
Copy link

superhail commented Nov 19, 2019

I noticed that in file "index.js" line 14, you add the seed by (MAX_INT32 - 1) which is 2147483646 when seed <= 0, but the implementation on wikipedia and the book around my hand "Data structures and algorithm analysis in c++" all add the seed by 2147483647 when seed < 0.
And I also noticed that in file "index.js" line 25 you use Math.round to get integer from the float value. but if you implemented it in this way, your "integerInRange" will not get a uniform distribution in [min, max], min and max value is roughly half the possibility of other numbers.

@sindresorhus
Copy link
Owner

Thanks for letting me know. PR welcome if you have the interest, otherwise I’ll get to this eventually :)

@sindresorhus sindresorhus added bug Something isn't working help wanted Extra attention is needed labels Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants