module random: randint() range error #17935
Replies: 4 comments
|
The maximum range should be documented. |
0 replies
|
Yes, it should be documented as -2³¹+1 … 2³¹ - 1. One could then calculate: |
0 replies
|
Actually is is documented: https://docs.micropython.org/en/latest/genrst/modules.html#random |
0 replies
How true. But I agree, if the full range is needed (or a multiple on 2ⁿ), in other word for 32 in 4 billion cases, than that's the way to go. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Port, board and/or hardware
rp2
MicroPython version
MicroPython v1.26.0 on 2025-08-09; Raspberry Pi Pico with RP2040
The upper limit of the randint(a,b) doesn't behave as described in the documentation.
Reproduction
Expected behaviour
Expected to work up to the upper limit of 2³² - 1
Observed behaviour
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
All reactions