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

Rename RandomSource.triangle arguments #308

Conversation

Sleepy-Horse
Copy link
Contributor

The code of the function is

default double triangle(double min, double max) {
        return min + max * (this.nextDouble() - this.nextDouble());
    }

It can return min - max or min + max. I believe the arguments should be named center and maxDeviation.

@Sleepy-Horse Sleepy-Horse requested a review from a team as a code owner November 3, 2024 00:08
@CLAassistant
Copy link

CLAassistant commented Nov 3, 2024

CLA assistant check
All committers have signed the CLA.

@sciwhiz12 sciwhiz12 added bug An error, misspell, incorrect information, or other issue minor changes Minor changes 1.21.x For Minecraft 1.21.x mappings Changes to the mapping data labels Nov 9, 2024
Copy link
Member

@sciwhiz12 sciwhiz12 left a comment

Choose a reason for hiding this comment

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

Ah, because nextDouble() returns a value from 0.0 to 1.0 in each call, the value of the multiplier to max can range from 1.0 (1.0 - 0.0) to -1.0 (0.0 - 1.0), or thereabouts when accounting for 1.0 being the exclusive range (rather than inclusive). Looks fine to me, then.

@sciwhiz12 sciwhiz12 merged commit de521f8 into ParchmentMC:versions/1.21.x Nov 9, 2024
2 checks passed
@Sleepy-Horse Sleepy-Horse deleted the versions/1.21.x-triangle-arguments branch November 13, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.x For Minecraft 1.21.x bug An error, misspell, incorrect information, or other issue mappings Changes to the mapping data minor changes Minor changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants