Skip to content

RandomNumberGenerator - randi_range and randf_range can swap endpoints #11417

@elowynd-id

Description

@elowynd-id

Your Godot version:
4.5.1

Issue description:
The document for the RandomNumberGenerator class is missing some pieces of information regarding what happens when float randf_range(from: float, to: float) and int randi_range(from: int, to: int) are called with from > to.
For randi_range, the documentation of the GobalScope functions explains that the parameters are swapped when such a situation occurs. It seems to be the same for methods from the class RandomNumberGenerator, but the documentation does not mention it.
It is not necessarily an obvious behavior. One could, for instance, expect and exception. So I think the documentation of these two methods should mention this behavior.

URL to the documentation page (if already existing):
https://docs.godotengine.org/en/latest/classes/class_randomnumbergenerator.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:class referenceIssues and PRs about the class reference, which should be addressed on the Godot engine repositoryenhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions