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

added more utility functions to Random #7141

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

minhnhdo
Copy link
Contributor

No description provided.

@magnus-madsen
Copy link
Member

@minhnhdo Thanks for your contribution and welcome to little community!

Could I ask you to add your name to AUTHORS.md to make clear this is open source? Thanks!

import java.lang.Integer.shortValue(): Int16 \ {};
nextInRange(r, minInclusive = Int16.toInt32(Int16.minValue()), maxExclusive = Int16.toInt32(Int16.maxValue()) + 1)
|> valueOf
|> shortValue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to just create a random Int32 and then immediately convert it to an Int16?

I think that would be simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me preface that I'm a random number generation noob.

Any reason not to just create a random Int32 and then immediately convert it to an Int16?

I don't know if doing that would make the generated pattern no longer uniform. Do you know?

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

Successfully merging this pull request may close these issues.

None yet

2 participants