Skip to content

Commit

Permalink
GH-102653: Make recipe docstring show the correct distribution (GH-10…
Browse files Browse the repository at this point in the history
…2742)

(cherry picked from commit b0ec625)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
  • Loading branch information
miss-islington and rhettinger authored Mar 16, 2023
1 parent 0560fe3 commit 4a7faac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Doc/library/random.rst
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ from the combinatoric iterators in the :mod:`itertools` module:
return tuple(pool[i] for i in indices)

def random_combination_with_replacement(iterable, r):
"Random selection from itertools.combinations_with_replacement(iterable, r)"
"Choose r elements with replacement. Order the result to match the iterable."
# Result will be in set(itertools.combinations_with_replacement(iterable, r)).
pool = tuple(iterable)
n = len(pool)
indices = sorted(random.choices(range(n), k=r))
Expand Down

0 comments on commit 4a7faac

Please sign in to comment.