Repository navigation
gh-162817: Add randbool recipe to random documentation - #162836
Open
George-Ogden wants to merge 8 commits into
Open
George-Ogden wants to merge 8 commits into
George-Ogden wants to merge 8 commits into
Conversation
Documentation build overview
|
picnixz
reviewed
Nov 29, 2026
picnixz
left a comment
Member
There was a problem hiding this comment.
The recipe is really really small and this could help but... at the same time I'm not sure if this warrants a new recipe. We could just enhance the random() entry as well saying that random.random() < p can be used to sample a boolean according to a Bernoulli distribution of parameter p assuming p in [0,1].
picnixz
reviewed
Nov 29, 2026
picnixz
reviewed
Nov 29, 2026
picnixz
reviewed
Nov 29, 2026
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
picnixz
reviewed
Nov 29, 2026
picnixz
approved these changes
Nov 29, 2026
skirpichev
reviewed
Nov 29, 2026
Comment on lines
+303
to
+304
| To generate :const:`True` with probability ``0.0 <= p <= 1.0``, | ||
| use ``random() < p``. |
Member
There was a problem hiding this comment.
Not sure if that belongs to the random() docs. Lets wait approval from Raymond or some his feedback in the issue thread.
Member
There was a problem hiding this comment.
i didn't want to create a separate recipe for this very small information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #162817
random.randboolfor Bernoulli distribution overbool#162817