-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Multiple Random Numbers Support #5518
Conversation
Took 26 minutes
Took 2 minutes
Took 3 minutes
Took 15 minutes
Took 3 minutes
return new Double[] {ll + rand.nextDouble() * (uu - ll)}; | ||
Double[] doubles = new Double[amount]; | ||
for (int i = 0; i < amount; i++) | ||
doubles[i] = lower + rand.nextDouble() * (upper - lower); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not guaranteed to be within the bounds due to number rounding, you should check whether the new value is less than upper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, this is also another thing that was unchanged by me, presuming i just need to make sure the bigger one is under upper?
@Ankoki conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My changes weren't addressed since last time, don't know why I was re-requested.
It was a misclick, but there are follow up questions/statements. |
Alright, having looked I think these are probably something that needs more team input: do we keep the original (but potentially wrong) behaviour or do we improve it but risk a tiny breaking change? |
Apologies I did completely forget about this PR, when i'm back from my trip i'll add the requested change. |
@Ankoki conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR ⚡
@Name("Random Number") | ||
@Description({"A random number or integer between two given numbers. Use 'number' if you want any number with decimal parts, or use use 'integer' if you only want whole numbers.", | ||
@Name("Random Numbers") | ||
@Description({"A given amount of random numbers or integers between two given numbers. Use 'number' if you want any number with decimal parts, or use use 'integer' if you only want whole numbers.", | ||
"Please note that the order of the numbers doesn't matter, i.e. <code>random number between 2 and 1</code> will work as well as <code>random number between 1 and 2</code>."}) | ||
@Examples({"set the player's health to a random number between 5 and 10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an example for decimals as well, also use same formatting as description
bd134d0
to
3f08853
Compare
@Ankoki Do you intend to continue working on this, or should we make the requested changes for you? |
Co-authored-by: Ayham Al Ali <20037329+AyhamAl-Ali@users.noreply.github.com>
If it's not already clear, I'm taking this over :) |
Took 26 minutes
Description
Support multiple random numbers being retrieved.
I put them in one pattern as the possibility of a person putting
1 random number
is there, so an optional [s] after numbers/integers is still wanted.Target Minecraft Versions: Any
Requirements: N/A
Related Issues: #5517