# Is there an elegant way to generate the permutations of all the members of a set?

**URL:** https://discourse.processing.org/t/is-there-an-elegant-way-to-generate-the-permutations-of-all-the-members-of-a-set/31810
**Category:** Coding Questions
**Created:** [August 20, 2021, 5:04pm UTC](https://discourse.processing.org/t/is-there-an-elegant-way-to-generate-the-permutations-of-all-the-members-of-a-set/31810 "2021-08-20T17:04:55Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [August 20, 2021, 6:13pm UTC](https://discourse.processing.org/t/is-there-an-elegant-way-to-generate-the-permutations-of-all-the-members-of-a-set/31810/3 "2021-08-20T18:13:19Z")

</div>

It is possible. But I have a few questions. What do you want to achieve in the end? `123456` as number may not be convenient as a lookup table. You may want to store it as an array or string `"123456"`. How are you referencing it to map to color?

I checked the referenced topic and it seems @jeremydouglass already gave an answer in a Python script. It would be so much nicer if you’d have explicitly linked it in the first place 🙂 and I guess, it’s a matter of porting it to Java.

> [@10 print chr$(205.5+rnd(1)); : goto 10](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/63):
>
> OK. Here goes: [Is there an elegant way to generate the permutations of all the members of a set?](https://discourse.processing.org/t/is-there-an-elegant-way-to-generate-the-permutations-of-all-the-members-of-a-set/31810)@jeremydouglass

---

_[View the full topic](https://discourse.processing.org/t/is-there-an-elegant-way-to-generate-the-permutations-of-all-the-members-of-a-set/31810)._
