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

randomInt documentation wrong #381

Closed
s9w opened this Issue May 26, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@s9w

s9w commented May 26, 2015

The documentation mentions a call without arguments math.randomInt(), but that is not actually implemented in the code.

Also the documentation does not state if the min and max limits are inclusive or exclusive. This is especially important because this library handles the limits different than almost any other.

@devanp92

This comment has been minimized.

Contributor

devanp92 commented May 27, 2015

It is written in the first line in the documentation: Return a random integer number larger or equal to min and smaller than max using a uniform distribution.

This might be tricky to read, but it includes min, excludes max.

They are also written in the test cases. However, this needs to be easier to read in the documentation.

@s9w

This comment has been minimized.

s9w commented May 27, 2015

Oops, sorry about the range.

@josdejong

This comment has been minimized.

Owner

josdejong commented May 27, 2015

Devan made a fix for this, see #382

@devanp92

This comment has been minimized.

Contributor

devanp92 commented May 27, 2015

As referenced here, I propose we either remove randomInt(no arguments) or make randomInt(no arguments) return a number between 0 and Number.MAX_VALUE (from Mozilla's Javascript reference).

Having randomInt() return an integer between [0,1) will always return 0 thus defeating it's purpose.

@josdejong josdejong closed this in 82ed4ca May 31, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment