-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
python -m random --float N
should pick a float between 0 and N, not 1 and N
#123968
Labels
3.13
bugs and security fixes
3.14
new features, bugs and security fixes
release-blocker
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
Comments
This was referenced Sep 11, 2024
andersk
added a commit
to andersk/cpython
that referenced
this issue
Sep 11, 2024
`python -m random --float N` incorrectly used a range between 1 and N of length N - 1. Fix it to use a range between 0 and N of length N, as originally specified in python#118131, and as everyone will expect. Fixes python#123968. Signed-off-by: Anders Kaseorg <[email protected]>
andersk
added a commit
to andersk/cpython
that referenced
this issue
Sep 11, 2024
`python -m random --float N` incorrectly used a range between 1 and N of length N - 1. Fix it to use a range between 0 and N of length N, as originally specified in python#118131, and as everyone will expect. Fixes python#123968. Signed-off-by: Anders Kaseorg <[email protected]>
To avoid compatibility issues, it would be good to fix this in 3.13.0 so I added release-blocker. Please let me know if that's inappropriate |
hugovk
pushed a commit
that referenced
this issue
Sep 12, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Sep 12, 2024
…onGH-123971) (cherry picked from commit a362c41) Co-authored-by: Anders Kaseorg <[email protected]>
Merged and backported, thanks! |
nanjekyejoannah
pushed a commit
that referenced
this issue
Sep 25, 2024
* fix -f/--float command line option description See gh-123968 gh-124009 * Update Doc/library/random.rst --------- Co-authored-by: Sergey B Kirpichev <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Sep 25, 2024
…onGH-124517) * fix -f/--float command line option description See pythongh-123968 pythongh-124009 * Update Doc/library/random.rst --------- (cherry picked from commit f8651a2) Co-authored-by: Robert Wolff <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
Yhg1s
pushed a commit
that referenced
this issue
Sep 26, 2024
…124517) (#124523) gh-123968: fix -f/--float command line option description (GH-124517) * fix -f/--float command line option description See gh-123968 gh-124009 * Update Doc/library/random.rst --------- (cherry picked from commit f8651a2) Co-authored-by: Robert Wolff <[email protected]> Co-authored-by: Sergey B Kirpichev <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.13
bugs and security fixes
3.14
new features, bugs and security fixes
release-blocker
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
In the specification for the new
python -m random
CLI for 3.13 (#118131), the proposed behavior wasHowever, what was actually implemented (#118132, cc @hugovk) was
This is surprising and not helpful. Everyone will expect a range of length
N
starting from0.0
, not a range of lengthN - 1.0
starting from1.0
.(Note that this is completely distinct from the debate about whether it’s more natural to select integers from
[1, …, N]
or[0, …, N - 1]
, as at least those are both ranges of lengthN
.)CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
python -m random --float
#123971python -m random --float
(GH-123971) #124009The text was updated successfully, but these errors were encountered: