Skip to content

gh-162817: Add randbool recipe to random documentation - #162836

Open
George-Ogden wants to merge 8 commits into
python:mainfrom
George-Ogden:randbool-recipe
Open

George-Ogden wants to merge 8 commits into
python:mainfrom
George-Ogden:randbool-recipe

Conversation

@George-Ogden

@George-Ogden George-Ogden commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor
@read-the-docs-community

read-the-docs-community Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36248701 | 📁 Comparing 14544df against main (31ed3ef)

  🔍 Preview build  

1 file changed
± library/random.html

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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].

Comment thread Doc/library/random.rst Resolved
Comment thread Doc/library/random.rst Resolved
Comment thread Doc/library/random.rst Resolved
Comment thread Doc/library/random.rst Resolved
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Comment thread Doc/library/random.rst Resolved
Comment thread Doc/library/random.rst
Comment on lines +303 to +304
To generate :const:`True` with probability ``0.0 <= p <= 1.0``,
use ``random() < p``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if that belongs to the random() docs. Lets wait approval from Raymond or some his feedback in the issue thread.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't want to create a separate recipe for this very small information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge docs Documentation in the Doc dir skip news type-feature A feature request or enhancement

3 participants