Doc: Fix random.uniform example comment. #25784
Merged
+1
−1
Conversation
|
Note, the example isn't using two different values.
Also, I think the docs should be left as-is. The intention was to create a half-open interval. In a small way, this make the docs slightly worse. Are you responding to a reported user problem? |
That's right, nice catch. I'm trying to find an example: from collections import Counter
import math
from random import uniform
start = 0
while True:
stop = math.nextafter(start, math.inf)
assert start != stop
values = Counter([uniform(start, stop) for _ in range(100)])
assert len(values) == 2
assert start in values
assert stop in values
start = stopI cannot find an example where the end is not included using the code above, do you have an example where the end is excluded?
Yes from docs@. |
|
Thanks @JulienPalard for the PR, and @rhettinger for merging it |
|
GH-25843 is a backport of this pull request to the 3.9 branch. |
miss-islington
added a commit
to miss-islington/cpython
that referenced
this pull request
May 3, 2021
(cherry picked from commit 440c025) Co-authored-by: Julien Palard <julien@palard.fr>
miss-islington
added a commit
that referenced
this pull request
May 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Checked using: