godotengine / godotengine/godot-docs
`RandomNumberGenerator` - `randi_range` and `randf_range` can swap endpoints
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.