-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Introduce Utils::getRandomFloat() #6532
Introduce Utils::getRandomFloat() #6532
Conversation
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 would've been a lot more straightforward to review if you hadn't introduced unnecessary extra changes
Would it be better if we implement |
Well, really the randoms should be derived from a World-local Random object instead of on a process-global Random state, since the current way makes it basically impossible to reproduce random-driven events with a seed. However that's outside the scope of this PR. Basically I don't think there's a need for modifying the Math library, although others may disagree. |
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 needs to target minor-next
The base branch was changed.
The Math library right now is more like a linalg/minecraft-coordinates library. I don't think it is a good idea to add random math-related functions into that library. |
Related issues & PRs
Changes
API changes
pocketmine\utils\Utils::getRandomFloat(float $min = 0.0, float $max = 1.0): float
Behavioural changes
Backwards compatibility
Follow-up
Tests