Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a note about how to permute with replacement #524

Closed
CraftSpider opened this issue Feb 3, 2021 · 1 comment · Fixed by #724
Closed

Add a note about how to permute with replacement #524

CraftSpider opened this issue Feb 3, 2021 · 1 comment · Fixed by #724

Comments

@CraftSpider
Copy link

Currently, trying to get 'permutations with replacement', it's hard to find in the documentation how to do that. I eventually found on the github from the issue about adding permutations how repeat_n(iter, iter.len()).multi_cartesian_product() can do what I want, but it would be nice if this was mentioned in the docs, either on permutations or as a search alias on multi_cartesian_product.

Alternatively, it might be nice to have permutation_with_replacement, but I'm not sure if that's common enough that it's desired in the API.

@Raizex
Copy link

Raizex commented Aug 21, 2022

This was exactly what I needed as well, and was no where near obvious on how to achieve.

This is a very common use case, I would imagine, as it's a necessary step for computing the probability of rolling sum s on n dice and other similar probability calculations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants