Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
In the specification for the newpython -m random CLI for 3.13 (#118131), the proposed behavior was
if it's a float, print a random float between 0 and the input (viarandom.uniform).
However, what was actually implemented (#118132, cc@hugovk) was
$python -m random --help[…] -f, --float N print a random floating-point number between 1 and N inclusive$python -m random 2.01.883974829952927$python -m random 2.01.034610672623156$python -m random 2.01.3676261878147473$python -m random 2.01.1875340810783404$python -m random 2.01.6148479875565644$python -m random 1.01.0
This is surprising and not helpful. Everyone will expect a range of lengthN 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 selectintegers 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
Metadata
Metadata
Assignees
Labels
Projects
Status
Done