Skip to content

Add random_derangement recipe#138377

Merged
rhettinger merged 3 commits intopython:mainfrom
rhettinger:random_derangement
Sep 4, 2025
Merged

Add random_derangement recipe#138377
rhettinger merged 3 commits intopython:mainfrom
rhettinger:random_derangement

Conversation

@rhettinger
Copy link
Copy Markdown
Contributor

@rhettinger rhettinger commented Sep 2, 2025

if len(seq) < 2:
raise ValueError('derangments require at least two values')
while True:
perm = random_permutation(seq)
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 think this depending on another recipe should be highlighted, as it may cause confusion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will inline the code.

@rhettinger rhettinger merged commit f9a40c3 into python:main Sep 4, 2025
27 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Sep 4, 2025
lkollar pushed a commit to lkollar/cpython that referenced this pull request Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants